Jump to content

Photo

mysql : help needed


  • Please log in to reply
2 replies to this topic

#1 Dorian

Dorian

    Adept

  • Members
  • Location:France

Posted 26 July 2007 - 06:23 AM

I am currently programming the v2 of my site
but I came across an annoying problem :
I keep on getting the same error message
QUOTE
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in... line 56

with this code :
CODE
54. $sql = "SELECT * from DP_news WHERE passage=1184408630";
55. $result = mysql_query($sql);
56. print_r(mysql_fetch_array($result));


one hour I'm trying to resolve the problem... what's wrong?
I really don't understand, I even copy-pasted an exemple on the w3school website and it still won't work ! icon_mad.gif
any suggestion? icon_sorry.gif



#2 Saffith

Saffith

    IPv7 user

  • Members

Posted 26 July 2007 - 07:38 AM

The query's failing for some reason...
Try this:
CODE
$sql = "SELECT * from DP_news WHERE passage=1184408630";
$result = mysql_query($sql) or die(mysql_error());
print_r(mysql_fetch_array($result));

That way, it should tell you why it's failing.

#3 Dorian

Dorian

    Adept

  • Members
  • Location:France

Posted 26 July 2007 - 11:30 AM

that doesn't let me know more or less ... icon_frown.gif

EDIT: this is strange, the homepage was working yesterday but now there are tons of mysql resource errors...
something must be wrong about the database :/

EDIT2 : i copied the table content to another, made the codes changes and the index page was working again.
then I noticed that I didn't selected my database (it was selected but only in the if's first branch) on the "else" branch.
after some code cleaning it's working icon_smile.gif

thanks anyway icon_wink.gif

Edited by Dorian, 26 July 2007 - 12:25 PM.



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users