adamjones Posted April 13, 2009 Share Posted April 13, 2009 Ok. So I'm making some really basic forums. I'm trying to echo data from a table, depending on the forum name, and ID of the post; <?php ....DB Connection.... $forum=$_GET['forum']; $id=$_GET['id']; $sql="SELECT * FROM $tbl_name WHERE forum='$forum' AND id='$id'"; $result=mysql_query($sql); $rows=mysql_fetch_array($result); ?> And then I will echo the rows, eg; <? echo $rows['topic']; ?> But I keep getting this error; Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/domainey/public_html/habhub/topic.php on line 69 Any ideas? Cheers. Link to comment https://forums.phpfreaks.com/topic/153928-solved-cant-get-this-to-work-agh/ Share on other sites More sharing options...
socratesone Posted April 13, 2009 Share Posted April 13, 2009 Change this: $result=mysql_query($sql); to this: echo $sql; $result=mysql_query($sql) or die(mysql_error()); And post what you see. Link to comment https://forums.phpfreaks.com/topic/153928-solved-cant-get-this-to-work-agh/#findComment-808984 Share on other sites More sharing options...
adamjones Posted April 13, 2009 Author Share Posted April 13, 2009 Change this: $result=mysql_query($sql); to this: echo $sql; $result=mysql_query($sql) or die(mysql_error()); And post what you see. SELECT * FROM general_forum_question WHERE forum='general' AND id='1'Unknown column 'forum' in 'where clause' ooops. silly me. forgot to add that colum!! thanks Link to comment https://forums.phpfreaks.com/topic/153928-solved-cant-get-this-to-work-agh/#findComment-808989 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.