Jump to content

Archived

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

Meza44

error message HELP

Recommended Posts

I get this error message from my code and I don't know why.  I am new to php.

Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in /home/content/i/b/e/ibezamn/html/change.php on line 15



<html>
<head><title>Ibezamn - Update</title>
</head>

<?

$id=$_GET['id'];

include("capsroster.inc.php");

mysql_connect(localhost,$username,$password);

$query="SELECT * FROM roster WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

$i=0;
while($i<$num) {
$first=mysql_result($result,$i,"first");
$last=mysql_result($result,$i,"last");
$number=mysql_result($result,$i,"number");
$position=mysql_result($result,$i,"position");
$height=mysql_result($result,$i,"height");
$weight=mysql_result($result,$i,"weight");
$shoots=mysql_result($result,$i,"shoots");
$dob=mysql_result($result,$i,"dob");
?>


<form action="update.php" method="get">
<input type="hidden" name="ud_id" value="<? echo $id; ?>"><br>
First:<input type="text" name="ud_first" value="<? echo $first; ?>"><br>
Last:<input type="hidden" name="ud_last" value="<? echo $last; ?>"><br>
Number:<input type="hidden" name="ud_number" value="<? echo $number; ?>"><br>
Height:<input type="hidden" name="ud_height" value="<? echo $height; ?>"><br>
Weight:<input type="hidden" name="ud_weight" value="<? echo $weight; ?>"><br>
Shoots:<input type="hidden" name="ud_shoots" value="<? echo $shoots; ?>"><br>
DOB:<input type="hidden" name="ud_dob" value="<? echo $dob; ?>"><br>
<input type="submit" value='Update">
</form>
<?

++$i;
}

?>

</body>
</html>

Share this post


Link to post
Share on other sites
Hi, ylou probably justy need to select the database

mysql_connect(localhost,$username,$password);
[color=blue]mysql_select_db("mydbname");[/color]
$query="SELECT * FROM roster WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();

cheers,
tdw

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.