l33t_script3r Posted May 27, 2006 Share Posted May 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/10562-invalid-resource-using-mysql_fetch_array-and-assoc/ Share on other sites More sharing options...
hvle Posted May 27, 2006 Share Posted May 27, 2006 question:- did you connected to database, did you select the database schema?- did forums_topics table exist in your schema? Quote Link to comment https://forums.phpfreaks.com/topic/10562-invalid-resource-using-mysql_fetch_array-and-assoc/#findComment-39389 Share on other sites More sharing options...
l33t_script3r Posted May 27, 2006 Author Share Posted May 27, 2006 Yes and Yes!lolits still not working but ty for your help so far anyway Quote Link to comment https://forums.phpfreaks.com/topic/10562-invalid-resource-using-mysql_fetch_array-and-assoc/#findComment-39390 Share on other sites More sharing options...
hvle Posted May 27, 2006 Share Posted May 27, 2006 I didn't see anything wrong with the snippet you posted.Can you post the more code and indicate the line 110. Quote Link to comment https://forums.phpfreaks.com/topic/10562-invalid-resource-using-mysql_fetch_array-and-assoc/#findComment-39393 Share on other sites More sharing options...
redarrow Posted May 27, 2006 Share Posted May 27, 2006 [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] Quote Link to comment https://forums.phpfreaks.com/topic/10562-invalid-resource-using-mysql_fetch_array-and-assoc/#findComment-39400 Share on other sites More sharing options...
l33t_script3r Posted May 27, 2006 Author Share Posted May 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/10562-invalid-resource-using-mysql_fetch_array-and-assoc/#findComment-39403 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.