viewing the thread
Moderator: General Moderators
viewing the thread
hi there,
i have here a forum like program, i am able to write info to the database, post the title of the thread, made the title a link so it can be viewed, but now i am stuck from here. i have no idea how i can view the thread, i programmed the reportviewer page but unfortunately, i cant view the thread that i'm trying to retrieve...pls help
thanks
pleigh
i have here a forum like program, i am able to write info to the database, post the title of the thread, made the title a link so it can be viewed, but now i am stuck from here. i have no idea how i can view the thread, i programmed the reportviewer page but unfortunately, i cant view the thread that i'm trying to retrieve...pls help
thanks
pleigh
its like this, u saw my thread, i mean, the topic i posted.right?now when u click the topic, you are opening the viewtopic.now, my problem is, im stuck from here, i cannot load or call or get the message from the database to be displayed in the viewtopic page.
this is my query for the display topics:
sorry, im really stuck.if u want to see my query in the viewtopic page, look at the code below:
hope you can help me guys...
this is my query for the display topics:
Code: Select all
$query = "SELECT date, title, postID FROM posts ORDER BY date DESC";
$result = @mysql_query($query);
if ($result)
{
while($row = mysql_fetch_array($result, MYSQL_NUM))
{
$post = $rowї2];
echo "<tr><td width=80%><a href="reportviewindex.php?$rowї2]" class="under">$rowї1]</td><td width=20%>$rowї0]</td></tr>";
}
mysql_free_result($result);
}
else
{
echo 'system error!<br>'.mysql_error();
}Code: Select all
$query = "SELECT title, accomplishment, issue, recommendation FROM posts WHERE postID='(---i'm lost here---)'";
$result = @mysql_query($query);
if ($result)
{
$row = mysql_fetch_array($result, MYSQL_NUM);
echo "<tr><td width=100%>$rowї0]</td></tr>";
echo "<tr><td width=100%>$rowї1]</td></tr>";
echo "<tr><td width=100%>$rowї2]</td></tr>";
echo "<tr><td width=100%>$rowї3]</td></tr>";
}
else
{
echo 'system error!<br>'.mysql_error();
}- n00b Saibot
- DevNet Resident
- Posts: 1452
- Joined: Fri Dec 24, 2004 2:59 am
- Location: Lucknow, UP, India
- Contact:
ultimately the forum topic should have a unique ID, requiring it to be in it's own table. Then when someone posts a reply to that topic, you'd have a field in your reply table perhaps named "topicid" that you would insert the reply to.. for example the topic ID was 87, you'd INSERT INTO replies (topicid, message) values ('87', '$message');
then to load the page thread you'd call all the replies that have a topicid of 87.
At least this is how I do it.
then to load the page thread you'd call all the replies that have a topicid of 87.
At least this is how I do it.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
There supposed to be a variable name before $row[2]?lreportviewindex.php?$row[2]
Forums are a simple structure. Forum->Topic->Post
To display all posts in a topic - you should have a topic id. Otherwise how are you going to track a thread? Unless your reasoning is a flat forum - no threading. Where only posts need an ID?
hey guys, thanks, i figured it out last night, i changed
to
toreportviewindex.php?$row[2]
then to the handling page, changed thecode fromreportviewindex.php?pid={$row[2]}
Code: Select all
$query = "SELECT title, accomplishment, issue, recommendation FROM posts WHERE postID='(---i'm lost here---)'";
$result = @mysql_query($query);Code: Select all
$id = $_GETї'pid'];
require_once('dbconnect.php');
$query = "SELECT title, accomplishment, issue, recommendation FROM posts WHERE postID='$id'";
$result = @mysql_query($query);-
d3ad1ysp0rk
- Forum Donator
- Posts: 1661
- Joined: Mon Oct 20, 2003 8:31 pm
- Location: Maine, USA
There's times when sending someone to check out pre-existing software helps. This is not one of those times.n00b Saibot wrote:see how phpBB solves this matter.
phpBB's source is HUGE. If you didn't notice. It took me a long time to be able to look at a random chunk of their code and know what's going on, I don't see how it's going to help him.