Jump to content


Photo

Invalid resource using mysql_fetch_array and assoc


  • Please log in to reply
5 replies to this topic

#1 l33t_script3r

l33t_script3r
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 May 2006 - 05:50 AM

Hey!

ill cut to the chase [img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /]
when i use this code:

$topiclist = mysql_query("SELECT * FROM forums_topics ORDER by id DESC");
while($row_topics = mysql_fetch_assoc($topiclist)){
?>
test
<? } ?>

and preview it, it comes up with this error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\Program Files\Apache Group\Apache2\htdocs\bloodspill\index.php on line 110

tia for your help

#2 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 27 May 2006 - 05:58 AM

question:

- did you connected to database, did you select the database schema?
- did forums_topics table exist in your schema?

Life's too short for arguing.

#3 l33t_script3r

l33t_script3r
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 May 2006 - 06:02 AM

Yes and Yes!
lol
its still not working but ty for your help so far anyway

#4 hvle

hvle
  • Members
  • PipPipPip
  • Advanced Member
  • 667 posts
  • Locationmelbourne, Australia

Posted 27 May 2006 - 06:12 AM

I didn't see anything wrong with the snippet you posted.
Can you post the more code and indicate the line 110.
Life's too short for arguing.

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 May 2006 - 07:49 AM


$db=mysql_connect("localhost","username","password");

mysql_select_db("database name",$db);

$topiclist ="SELECT * FROM forums_topics ORDER by id DESC";

$result=mysql_query($topiclist);

while($row_topics = mysql_fetch_assoc($topiclist)){

while(list($title,$data)=each($row)){
?>
echo "<br> $title : $data <br>";
<? 
} 
}
?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 l33t_script3r

l33t_script3r
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 27 May 2006 - 08:19 AM

errrm lol what was that for? [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

anyways...

its just that table that isnt working, i even copied the name of the table from phpmyadmin and it didnt work...
i tried a different table and it worked fine, not sure what is going on here




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users