loony383 Posted August 7, 2007 Share Posted August 7, 2007 Hi, im trying to make a forum and in my veiw_forum.php its supposed to only show the posts with the forumid the same as the forum id in the link forum the page before (www.domain.com/view_forum.php?forumid=1) , this is my code so far but it isnt working, can someone tell me whats going wong? <html> <head> <title>Airboard - Beta</title> <?php include ("menu.php"); include "connect.php"; //mysql db connection here $_GET ['forumid']; print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<A href='post.php'>New Topic</a><br>"; print "<table class='maintable'>"; print "<tr class='headline'><td width=50%>Topic</td><td width=20%>Topic Starter</td><td>Replies</td><td>Last replied time</td></tr>"; $getthreads="SELECT * from forumtutorial_posts where parentid='0' and forumid= ['forumid'] order by realtime DESC"; $getthreads2=mysql_query($getthreads) or die("Could not get threads"); while($getthreads3=mysql_fetch_array($getthreads2)) { $getthreads3[title]=strip_tags($getthreads3[title]); $getthreads3[author]=strip_tags($getthreads3[author]); print "<tr class='mainrow'><td><A href='message.php?id=$getthreads3[postid]'>$getthreads3[title]</a></td><td>$getthreads3[author]</td><td>$getthreads3[numreplies]</td><td>$getthreads3[showtime]<br>Last post by <b>$getthreads3[lastposter]</b></td></tr>"; } print "</table>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/63794-retreiving-information-from-a-preivious-page/ Share on other sites More sharing options...
s0c0 Posted August 7, 2007 Share Posted August 7, 2007 This is what you want to do, echo our your sql query to the screen and run it directly. I think one of the problems in your sample of code there is that in your sql query you are not doing it like this: $getthreads = "SELECT * FROM forumtutorial_posts WHERE parentid='0' and forumid= '[b]$_GET[forumid][/b]' ORDER BY realtime DESC"; I'm anal and so I put all mysql keywords in caps, but the main part in there is the '$_GET[forumid]' Echoing your sql query is a to the screen and making sure that runs correctly is a good first step though, then you can move on to other portions of your code. Quote Link to comment https://forums.phpfreaks.com/topic/63794-retreiving-information-from-a-preivious-page/#findComment-317965 Share on other sites More sharing options...
loony383 Posted August 7, 2007 Author Share Posted August 7, 2007 <html> <head> <title>Airboard - Beta</title> <?php include ("menu.php"); include "connect.php"; //mysql db connection here $_GET ['forumid']; print "<link rel='stylesheet' href='style.css' type='text/css'>"; print "<A href='post.php'>New Topic</a>"; print "<table class='maintable'>"; print "<tr class='headline'><td width=50%>Topic</td><td width=20%>Topic Starter</td><td>Replies</td><td>Last replied time</td></tr>"; $getthreads="SELECT * from forumtutorial_posts where parentid='0' and forumid= ['forumid'] order by realtime DESC"; $getthreads2=mysql_query($getthreads) or die("Could not get threads"); while($getthreads3=mysql_fetch_array($getthreads2)) { $getthreads3[title]=strip_tags($getthreads3[title]); $getthreads3[author]=strip_tags($getthreads3[author]); print "<tr class='mainrow'><td><A href='message.php?id=$getthreads3[postid]'>$getthreads3[title][/url]</td><td>$getthreads3[author]</td><td>$getthreads3[numreplies]</td><td>$getthreads3[showtime] Last post by $getthreads3[lastposter]</td></tr>"; } print "</table>"; ?> i tried replacing your bit and it didnt work. ill send you the lik to where im trying to get to work http://www.airservers.com/airboard/veiw_forum.php?forumid=1 Quote Link to comment https://forums.phpfreaks.com/topic/63794-retreiving-information-from-a-preivious-page/#findComment-317968 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.