Jump to content

Retreiving information from a preivious page


loony383

Recommended Posts

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>";

?>

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.

<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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.