kenji akın kenji akın - 6 months ago 21
SQL Question

mysql_fetch_object() error: supplied argument is not a valid MySQL result resource

Here my error:


Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\sayfalar\arama.php on line 12


and here is my code

$aramaSorgu = mysql_query("Select * from icerikler left join turler on icerikler.turID=turler.turID where icerikBaslik like '%$kelime%' or icerik like '%$kelime%'");
while($aramaSonuc=mysql_fetch_object($aramaSorgu))
{
$bulunan++;
}


Error Message


Access denied for user ''@'localhost' to database 'site'

Answer

The issue is that for whatever reason, the query execution did not return a valid result.

Change up your query line to this to see why.

mysql_query(...) or die(mysql_error());

This will kill execution of the script, and print the MySQL error to the user if anything incorrect happened with the query call; the output from this message should help you to figure out the issue with the query.

Comments