mackevin Posted April 9, 2008 Share Posted April 9, 2008 <?php $tbl_name2="forum_answer"; // Switch to table "forum_answer" $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id'"; $result2=mysql_query($sql2); while($rows=mysql_fetch_array($result2)){ ?> is the code used this seems to be the reply Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/flyboyst/public_html/view_topic.php on line 81 what am I doing wrong here, it is for a simple php forum. PLEASE HELP thanks in advance ??? Link to comment https://forums.phpfreaks.com/topic/100393-can-someone-please-help-with-this-sql-query/ Share on other sites More sharing options...
merc123 Posted April 9, 2008 Share Posted April 9, 2008 Your code is incomplete. while($rows=mysql_fetch_array($result2)){ ?> That doesn't make any sense because you open the while statement then end the PHP. Should be something like: while($rows=mysql_fetch_array($result2)){ echo $rows['question_id']; } ?> Link to comment https://forums.phpfreaks.com/topic/100393-can-someone-please-help-with-this-sql-query/#findComment-513387 Share on other sites More sharing options...
mackevin Posted April 9, 2008 Author Share Posted April 9, 2008 it all makes so much sense when you see, thakns for the help merc123 that seems to work like a bomb now, thankyou Link to comment https://forums.phpfreaks.com/topic/100393-can-someone-please-help-with-this-sql-query/#findComment-513393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.