Jump to content

Mysql_Fetch_array error


ThePhpReaper

Recommended Posts

well, i tried to fetch field from my database using the following code:

$result=mysql_query("SELECT * FROM Persons WHERE username='$myusername'" );
while($row = mysql_fetch_row($result))

 

now that gives me following error:

Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in..

 

Link to comment
https://forums.phpfreaks.com/topic/228614-mysql_fetch_array-error/
Share on other sites

it's times like that that you will find error capture propper handy.

$result=mysql_query("SELECT * FROM Persons WHERE username='$myusername'" ) or die ('Query !FAILED! with following error  -- '.mysql_error();

Once you can see what the problem is, and I have a hunch what that is (but need more info to say more than it's an error in the query), you can then start to debug the issue, you can also post the error along with the code and we all have a better chance.  it's easier to help someone when they can post "check manual for syntax to use near 'WHERE username =' " than with a PHP error generated because the code failed to create the output.

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.