Jacbey Posted May 22, 2011 Share Posted May 22, 2011 hey guys; Another problem with sql. { echo "Welcome " . $row['username']; echo "<br />"; echo "<br />"; echo "<br />"; $msgquery = "SELECT * FROM spotty_messages WHERE (id_receiver = '" . $userid . "') AND message_read = '0'"; $messageres = mysql_query($msgquery); $messrow = mysql_fetch_array($messageres); $messagenum = mysql_num_rows($messageres); } $i = 0; while ($i < $messagenum) { $f1 = "From:" . mysql_result($messrow,$i,"sender"); echo " <tr> <td>" . $f1 ."</font></td> " ; $i++; } This is returning the error : Warning: mysql_result() expects parameter 1 to be resource, null given in /customers/klueless.net/klueless.net/httpd.www/daisysite/messages.php on line 106 Please help, thanks! Quote Link to comment https://forums.phpfreaks.com/topic/237110-mysql-error/ Share on other sites More sharing options...
wildteen88 Posted May 22, 2011 Share Posted May 22, 2011 You're using the wrong variable here $f1 = "From:" . mysql_result($messrow,$i,"sender"); You want to use the $messageres variable (this is the result resource) Quote Link to comment https://forums.phpfreaks.com/topic/237110-mysql-error/#findComment-1218663 Share on other sites More sharing options...
Jacbey Posted May 22, 2011 Author Share Posted May 22, 2011 You're using the wrong variable here $f1 = "From:" . mysql_result($messrow,$i,"sender"); You want to use the $messageres variable (this is the result resource) Whoo Thanks dude; I owe you one! Quote Link to comment https://forums.phpfreaks.com/topic/237110-mysql-error/#findComment-1218664 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.