Jump to content


Photo

Hideing a mysql result error


  • Please log in to reply
5 replies to this topic

#1 skatermike21988

skatermike21988
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts
  • LocationFlorida

Posted 14 September 2006 - 06:37 AM

Hello,

i am trying to find a way to hide this error

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in *****/index.php on line 75
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:
Your Search Has Returned No Results 
so when nothing returns this is what i am getting

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in ***/index.php on line 75

Your Search Has Returned No Results 
All i want to display is the your search has returned no results

#2 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 14 September 2006 - 06:40 AM

go to line 75
and take out the part at the end that says

or die(mysql_error())

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png

#3 skatermike21988

skatermike21988
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts
  • LocationFlorida

Posted 14 September 2006 - 07:43 AM

that is not in the script it is already removed..

#4 Zane

Zane
  • Administrators
  • Advanced Member
  • 4,134 posts

Posted 14 September 2006 - 07:48 AM

then go to the begginning of the function call
and put an @ symbol

probably looks like
$result = mysql_fetch_array($somequery)

should be
$result = @mysql_fetch_array($somequery);

btn_donate_SM.gif Want to thank me? Contribute to my PayPal piggy-bank
 

172938.png

#5 skatermike21988

skatermike21988
  • Members
  • PipPipPip
  • Advanced Member
  • 100 posts
  • LocationFlorida

Posted 14 September 2006 - 08:03 AM

That worked, thank you very much

#6 shoz

shoz
  • Staff Alumni
  • Advanced Member
  • 600 posts

Posted 14 September 2006 - 08:08 AM

You should use mysql_num_rows() to find out if any rows were returned.

if (mysql_num_rows($result))
{
    mysql_fetch_array(...)
}
else
{
    print 'no rows returned';
}

EDIT: The error actually implies something else has gone wrong with your query. You shouldn't be getting that error.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users