Jump to content

Invalid resource using mysql_fetch_array and assoc


l33t_script3r

Recommended Posts

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:

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

and preview it, it comes up with this error:

[code]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[/code]

tia for your help
Link to comment
Share on other sites

[code]

$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>";
<?
}
}
?>
[/code]
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.