Tom Wollaston wrote:
Hi
I am havening a problem retrieving url from a mysql database. I have the
url's stored as text and am using the following code to retrieve them


$query = "SELECT name,url FROM clubs WHERE url>'' ORDER BY name";


$result = @mysql_query($query) or die ("Query failed");

if (mysql_num_rows($result) == 0) {

print "No Club Links Found.";

} else {

while ($row = mysql_fetch_assoc($result)) {

print $row["name"] . "<A HREF= ".$row['url'].">";


This seems to work except the url refers to the previous name on the list produced with the first name as a blank url. Can anybody help

You have incorrect HTML. You're last line should look like this:


print "<a href=\"{$row['url']}\">{$row['name']}</a>";

You were starting your link after you printed out the value, without ending the link, so it continued to the next item and only ended when the next link started on the next row.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to