ThePhpReaper Posted February 23, 2011 Share Posted February 23, 2011 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.. Quote Link to comment https://forums.phpfreaks.com/topic/228614-mysql_fetch_array-error/ Share on other sites More sharing options...
AbraCadaver Posted February 23, 2011 Share Posted February 23, 2011 Your query failed. Use mysql_error() to see why. Quote Link to comment https://forums.phpfreaks.com/topic/228614-mysql_fetch_array-error/#findComment-1178715 Share on other sites More sharing options...
Muddy_Funster Posted February 23, 2011 Share Posted February 23, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/228614-mysql_fetch_array-error/#findComment-1178724 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.