Jump to content

[SOLVED] query error cant figure out?


darksniperx

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/80945-solved-query-error-cant-figure-out/
Share on other sites

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";

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

Archived

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

×
×
  • Create New...

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.