SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 24th, 2005, 07:33 PM
phpSLACKER phpSLACKER is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Toledo,OH,43604
Posts: 4 phpSLACKER User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PHP to Html hand off

I am working on a keyword link list. In a MySQL database I have 2 fields keyword and link. Using PHP I can retrieve these no problem. What I am trying to do is use the keyword variable $word and $link as a hyperlink. In the code example below you will find several echo lines I use to verify results that are superfluous. I also realize the a href in no way will work it is included to explain my intentions.

php Code:
Original - php Code
  1. <?php
  2. $location = "localhost";
  3. $username = "myuserename";
  4. $password = "somethingclever";
  5. $database = "navigation";
  6. $kword = $_POST['theword'];
  7.  
  8. $conn = mysql_connect("$location","$username","$password");
  9. if (!$conn) die ("Could not connect MySQL");
  10. mysql_select_db($database,$conn) or die ("Could not open database");
  11.  
  12. $query = "SELECT * FROM keyword";
  13. $result = mysql_query($query);
  14. while($row = mysql_fetch_array($result)){
  15. $word=$row[keyword];
  16. $link = $row[link] ;
  17.  
  18. echo 'KeyWord ';
  19. echo $word;
  20. echo '<p> </p>';
  21. echo $link;
  22. echo '<p> </p>';
  23. }
  24.  
  25. ?>
  26.  
  27. <a href="$link">"$word"</a>



ANy help will be ENORMOUSLY appreciated

Reply With Quote
  #2  
Old February 24th, 2005, 08:30 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: PHP to Html hand off

you need to dynamically generate the hyperlink in the while statement

php Code:
Original - php Code
  1.  
  2. while($row = mysql_fetch_array($result)){
  3. $word=$row[keyword];
  4. $link = $row[link] ;
  5.  
  6. echo "<a href='".$link."'>".$word."</a><br>";
  7. }
  8.  
  9.  

Reply With Quote
  #3  
Old February 25th, 2005, 12:50 PM
phpSLACKER phpSLACKER is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Toledo,OH,43604
Posts: 4 phpSLACKER User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: PHP to Html hand off

Thanks that did the trick. Apparently not a "Client Side Thing" after all.

Thanks again

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > PHP to Html hand off


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway