Query 5 Random Items - Loop Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ripcurlksm
Forum Commoner
Posts: 34
Joined: Sun Aug 08, 2004 9:17 pm

Query 5 Random Items - Loop Problem

Post by ripcurlksm »

Im trying to pull 5 random items from a database where status='selling' and I am getting a white page!

Code: Select all

$result = mysql_query("SELECT * FROM bookmark WHERE status='selling' ORDER BY rand() LIMIT 5");

$i=0;
while ($i < $result) {

//Dont I need this in there too:
//$bm_URL=mysql_result($result,$i,"bm_URL");
//$description=mysql_result($result,$i,"description");



echo "<a href="http://onestopauctionshop.com/spinco/hot_result.php?bm_URL=$bm_URL\>$description</a>";

++$i;
}
Regards,
Kevin
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

while($row = mysql_fetch_assoc($result))
{
  var_dump($row);
}
Post Reply