Jump to content

Infinite Loop - Oops


ccpokerd

Recommended Posts

Hey guys,I'm trying to create a loop to display menu items for each entry in a database...

$qry = "SELECT * FROM pages";$result = mysql_query($qry);$num = mysql_num_rows($result);$i = 0;while($i < $num) {	$dbPageID = mysql_result($result, $i, "id");	$dbPageTitle = mysql_result($result, $i, "title");echo "<a href=\"edit.php?id=$dbPageID\">$dbPageTitle</a><br />";}

at the moment I have just the one entry for testing purposes, and basically it just displays an infinite amount of links to edit this one entry. help!

Link to comment
Share on other sites

Try this:

$qry = "SELECT * FROM pages";$result = mysql_query($qry);while($row = mysql_fetch_array($result)){	$dbPageID = $row['id'];	$dbPageTitle = $row['title'];echo "<a href='edit.php?id=$dbPageID'>$dbPageTitle</a><br />";}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...