Forum Moderators: coopster
<?
include("dbinfo.inc.php");
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="select from todo where id='".$_GET['id']."' LIMIT 1";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num) {
$item=mysql_result($result,$i,"item");
$description=mysql_result($result,$i,"description");
$category=mysql_result($result,$i,"category");
$priority=mysql_result($result,$i,"priority");
?>
<form action="updated.php">
<input type="hidden" name="ud_id" value="<? echo "$id";?>">
Item: <input type="text" name="ud_item" value="<? echo "$item"?>"><br>
Description: <input type="text" name="ud_description" value="<? echo "$description"?>"><br>
Category: <input type="text" name="ud_category" value="<? echo "$category"?>"><br>
Priority: <input type="text" name="ud_priority" value="<? echo "$priority"?>"><br>
<input type="Submit" value="Update">
</form>
<?
++$i;
}
?>
so I would imagine your query is dying or not returning any rows.
1. try echoing the query to make sure it is getting the id properly
2. try executing the query itself via the commandline or in phpmyadmin
3. add an - or die (mysql_error()) to your mysql_query call to see if there is an error of some kind returned from mysql
4. echo out $num before you go into your while statement to see if it is infact 0
5. echo $i in each iteration of your while loop to see how many times it is looping in relationship to the value of $num
that should help you isolate why