skatermike21988 Posted September 14, 2006 Share Posted September 14, 2006 Hello,i am trying to find a way to hide this error[code]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in *****/index.php on line 75[/code]What i am doing is making a search form, the search works fine but when there are no results it comes up with error and displays this text i have it set to say underneath it:[code]Your Search Has Returned No Results [/code]so when nothing returns this is what i am getting[code]Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ***/index.php on line 75Your Search Has Returned No Results [/code]All i want to display is the your search has returned no results Quote Link to comment Share on other sites More sharing options...
Zane Posted September 14, 2006 Share Posted September 14, 2006 go to line 75and take out the part at the end that saysor die(mysql_error()) Quote Link to comment Share on other sites More sharing options...
skatermike21988 Posted September 14, 2006 Author Share Posted September 14, 2006 that is not in the script it is already removed.. Quote Link to comment Share on other sites More sharing options...
Zane Posted September 14, 2006 Share Posted September 14, 2006 then go to the begginning of the function calland put an @ symbolprobably looks like$result = mysql_fetch_array($somequery)should be$result = @mysql_fetch_array($somequery); Quote Link to comment Share on other sites More sharing options...
skatermike21988 Posted September 14, 2006 Author Share Posted September 14, 2006 That worked, thank you very much Quote Link to comment Share on other sites More sharing options...
shoz Posted September 14, 2006 Share Posted September 14, 2006 You should use [url=http://www.php.net/mysql_num_rows]mysql_num_rows()[/url] to find out if any rows were returned.[code]if (mysql_num_rows($result)){ mysql_fetch_array(...)}else{ print 'no rows returned';}[/code]EDIT: The error actually implies something else has gone wrong with your query. You shouldn't be getting that error. Quote Link to comment 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.