darksniperx Posted December 10, 2007 Share Posted December 10, 2007 Query failed Resource id #18 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Resource id #18' at line 1 $result_a = mysql_query("SELECT * FROM authortoperson WHERE feed_id = '$feed_id' AND entry_id = 0 "); //test code if ($sql = mysql_query($result_a)) { // query was successfull. if (mysql_num_rows($result_a)) { // rows were found, fetch array and display result. } else { echo "No rows found"; } } else { echo "Query failed<br />$result_a<br />" . mysql_error() ."<br />"; } give me the error message above, cant figure out why, any hints would be helpful! Quote Link to comment https://forums.phpfreaks.com/topic/80945-solved-query-error-cant-figure-out/ Share on other sites More sharing options...
pocobueno1388 Posted December 10, 2007 Share Posted December 10, 2007 You executing the query twice. Change this line $result_a = mysql_query("SELECT * FROM authortoperson WHERE feed_id = '$feed_id' AND entry_id = 0 "); To $result_a = "SELECT * FROM authortoperson WHERE feed_id = '$feed_id' AND entry_id = 0"; Quote Link to comment https://forums.phpfreaks.com/topic/80945-solved-query-error-cant-figure-out/#findComment-410627 Share on other sites More sharing options...
darksniperx Posted December 10, 2007 Author Share Posted December 10, 2007 the rest of my code doesn't work Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource and I have been using the $result = mysql_query(''); everywhere , and I never had a problem, just cant figure out why I have one now. php.net provided the code with an example and never showed any errors http://www.php.net/mysql_query Quote Link to comment https://forums.phpfreaks.com/topic/80945-solved-query-error-cant-figure-out/#findComment-410629 Share on other sites More sharing options...
pocobueno1388 Posted December 10, 2007 Share Posted December 10, 2007 Change this line if (mysql_num_rows($result_a)) To if (mysql_num_rows($sql)) Quote Link to comment https://forums.phpfreaks.com/topic/80945-solved-query-error-cant-figure-out/#findComment-410636 Share on other sites More sharing options...
darksniperx Posted December 10, 2007 Author Share Posted December 10, 2007 thx, I have just figured out what I did wrong, when I you said I was using mysql_queury twice, it took me while to notice, anyways I guess I was tired, thx again for the help! Quote Link to comment https://forums.phpfreaks.com/topic/80945-solved-query-error-cant-figure-out/#findComment-410653 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.