DarthViper3k Posted March 12, 2003 Share Posted March 12, 2003 ok I\'ve spent the better part of.... all day coding some PHP pages for my project (Private Messaging System.. Inbox and Send Private Message..... each are bout 150 or 200+ lines of code) brain... fried.... need extra pair of eyes to debug error Warning: Supplied argument is not a valid MySQL result resource in c:apachehtdocs3kphpInbox.php on line 40 block of code with error [php:1:decfc04bb6] while($pmnum = mysql_fetch_array($result)){ //line 40 if(mysql_num_rows($result) == 0) { echo(\"You don\'t have any Messages\"); } else { print(\"<TR><TD WIDTH=\'25%\'>\"); echo $pmnum[from]; print(\"</TD> <TD WIDTH=\'50%\'>\"); echo $pmnum[subject]; print(\"</TD> <TD WIDTH=\'25%\'>\"); echo $pmnum[sent]; print(\"</td></TR>\"); } } [/php:1:decfc04bb6] Quote Link to comment https://forums.phpfreaks.com/topic/218-not-valid-sql/ Share on other sites More sharing options...
effigy Posted March 12, 2003 Share Posted March 12, 2003 your query ( not listed ) didn\'t return any results... :shock: does it work if you ad hoc it? any syntax errors? Quote Link to comment https://forums.phpfreaks.com/topic/218-not-valid-sql/#findComment-651 Share on other sites More sharing options...
DarthViper3k Posted March 12, 2003 Author Share Posted March 12, 2003 your query ( not listed ) didn\'t return any results... :shock: does it work if you ad hoc it? any syntax errors? thats the only error I got.... didn\'t think about adding some rows to the database to see if it actually works I\'m gonna try that that is what your sayin right? edit... now I got that same error on line 15 as well as the above posted error [php:1:fd6390f548] $limit = 15; $messages = \"SELECT users FROM messages WHERE to=\'$username\'\"; $getmessages = mysql_query($messages); $pmnum = mysql_num_rows($getmessages); //line 15 [/php:1:fd6390f548] Quote Link to comment https://forums.phpfreaks.com/topic/218-not-valid-sql/#findComment-654 Share on other sites More sharing options...
shivabharat Posted March 17, 2003 Share Posted March 17, 2003 I guess the problem is either with ur connection string or ur query Try to run the query seperately and see whether u get any values. $link = mysql_connect(\"localhost\", \"username\", \"password\"); mysql_select_db(\"database\", $link); mysql_query($messages) or die("problem here "); Quote Link to comment https://forums.phpfreaks.com/topic/218-not-valid-sql/#findComment-700 Share on other sites More sharing options...
DarthViper3k Posted March 18, 2003 Author Share Posted March 18, 2003 uhh ok this makes no sense I got a 500 Internal Server Error I have no idea whats goin on edit: nevermind the error is gone however... my old error remains ok this makes a lot of sense I remove the or die(); part and it works fine edit ok I added more of the code and I have that same error Warning: Supplied argument is not a valid MySQL result resource in c:apachehtdocsmysqlqtest.php on line 7 [php:1:ac080681c1] $messages = \"SELECT users FROM messages\"; $getmessages = mysql_query($messages); $pmnum = mysql_num_rows($getmessages); // line 7 [/php:1:ac080681c1] what exactly is goin on? Quote Link to comment https://forums.phpfreaks.com/topic/218-not-valid-sql/#findComment-701 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.