Meza44 Posted October 6, 2006 Share Posted October 6, 2006 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> Link to comment https://forums.phpfreaks.com/topic/23157-error-message-help/ Share on other sites More sharing options...
thedarkwinter Posted October 6, 2006 Share Posted October 6, 2006 Hi, ylou probably justy need to select the databasemysql_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 Link to comment https://forums.phpfreaks.com/topic/23157-error-message-help/#findComment-104859 Share on other sites More sharing options...
steveclondon Posted October 6, 2006 Share Posted October 6, 2006 also add this after you query and see if there are any errors$result=mysql_query($query) or die(mysql_error()); Link to comment https://forums.phpfreaks.com/topic/23157-error-message-help/#findComment-104860 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.