MySQL Query/Loop only returns one row.
Posted: Mon Sep 06, 2004 2:14 am
feyd | Please use
feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
I am only getting one row returned from this query....
See it here [url=http://onestopauctionshop.com/preview/test.php?category=Motorcycle%20Parts]http://onestopauctionshop.com/preview/test.php?category=Motorcycle%20Parts[/url]
Here is the code:Code: Select all
<?php
$query = "SELECT * FROM bookmark WHERE category = '$P_category' AND status='selling' ";
$result = mysql_query($query);
$bm_URL=mysql_result($result, $rank, "bm_URL");
$bm_IMG=mysql_result($result, $rank, "bm_IMG");
$description=mysql_result($result, $rank,"description");
if(mysql_num_rows($result)) {
$rank = 1;
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
print("</tr><tr>");
if($color == "#666666") {
$color = "#999999";
} else {
$color = "#666666";
}
print("<td width="20" bgcolor="$color"><small>");
print("<font face="Verdana">$rank</font></small></td>");
print("<td width="20" bgcolor="$color"><small>");
print("<font face="Verdana">$description</font></small></td>");
print("<td width="20" bgcolor="$color"><center><small>");
print("<a href="$bm_IMG" target="new"><img src="$bm_IMG" height="50" border="0"></center></td>");
print("<td width="20" bgcolor="$color"><center><small>");
print("<a href="$bm_URL">Bid on this item!</a></center></td>");
$rank++;
}
}
?>feyd | Please use
Code: Select all
tags when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]