Hi
I have a database which should return data of the threads. The idea is to create a small community (only selected users may participate) where they can post their statements etc for others to see and reply to. The page giving me the problem is the one where a thread is selected and the data for that thread is called.
Here is the code i have (i have omitted the start of the page as it is not needed):
[code=php]
dbconnect();//connect to database with details and query the database
$result = mysql_query ("SELECT threads.title, posts.body, posts.dateposte d,
userdata.name, userdata.email, userdata.totalp osts, userdata.showem ail,
posts.postID, userdata.ID FROM threads, posts, userdata WHERE
posts.threadID = '$threadID' AND threads.threadI D = '$threadID' ORDER BY
posts.dateposte d ASC");
if (!$result){ fail("database query failed, threads page", false);}//checks to see if
failed, and fail to thread list
$rows = mysql_num_rows( $result);//see the amount of rows returned
if($rows==0){ fail("no post found for this thread", false); }//if no rows, fail to thread list
setuppage("Thre ads", "This is the posts of the selected thread");//setup the page for the thread
echo "<p align=right>".( $logged_as_mod ? "mod":"user")." : <b>$logged_in_u ser</b>
| <a href='logout.ph p'>Logout</a> | <a href='home.php' >Threadlist</a></p>
<hr align=center width='100%'>";//shows a standard message with a line underneath
while ($record = mysql_fetch_ass oc($result)){//this is the part which never gets executed
echo "<table width='100%' border='1'>
<tr>
<td width=100>".$re cord['name']."</td>
<td width=200>".$re cord['dateposted']."</td>
<td width=150>Posts so far...".$record['totalposts']."</td>
<td width=100>".($r ecord['showemail'] ? "<a
href='mailto:". $record["email"]."'>email user</a>" : "" )>"</td>
<td width=100>".($r ecord['ID']== $logged_userID || $logged_as_mod ?
"<a href='post.php? postID=".$recor d["postID"]."'>edit Post</a>" : "")."</td>
</tr>
</table>
<blockquote>
<p>".$record['body']."</p>
</blockquote>
<hr align=center width='100%'>";//this whole block returns only a "1" for
every post it should display
}//and from here it starts executing again[/code]
any help would be greatly appreciated.
I have a database which should return data of the threads. The idea is to create a small community (only selected users may participate) where they can post their statements etc for others to see and reply to. The page giving me the problem is the one where a thread is selected and the data for that thread is called.
Here is the code i have (i have omitted the start of the page as it is not needed):
[code=php]
dbconnect();//connect to database with details and query the database
$result = mysql_query ("SELECT threads.title, posts.body, posts.dateposte d,
userdata.name, userdata.email, userdata.totalp osts, userdata.showem ail,
posts.postID, userdata.ID FROM threads, posts, userdata WHERE
posts.threadID = '$threadID' AND threads.threadI D = '$threadID' ORDER BY
posts.dateposte d ASC");
if (!$result){ fail("database query failed, threads page", false);}//checks to see if
failed, and fail to thread list
$rows = mysql_num_rows( $result);//see the amount of rows returned
if($rows==0){ fail("no post found for this thread", false); }//if no rows, fail to thread list
setuppage("Thre ads", "This is the posts of the selected thread");//setup the page for the thread
echo "<p align=right>".( $logged_as_mod ? "mod":"user")." : <b>$logged_in_u ser</b>
| <a href='logout.ph p'>Logout</a> | <a href='home.php' >Threadlist</a></p>
<hr align=center width='100%'>";//shows a standard message with a line underneath
while ($record = mysql_fetch_ass oc($result)){//this is the part which never gets executed
echo "<table width='100%' border='1'>
<tr>
<td width=100>".$re cord['name']."</td>
<td width=200>".$re cord['dateposted']."</td>
<td width=150>Posts so far...".$record['totalposts']."</td>
<td width=100>".($r ecord['showemail'] ? "<a
href='mailto:". $record["email"]."'>email user</a>" : "" )>"</td>
<td width=100>".($r ecord['ID']== $logged_userID || $logged_as_mod ?
"<a href='post.php? postID=".$recor d["postID"]."'>edit Post</a>" : "")."</td>
</tr>
</table>
<blockquote>
<p>".$record['body']."</p>
</blockquote>
<hr align=center width='100%'>";//this whole block returns only a "1" for
every post it should display
}//and from here it starts executing again[/code]
any help would be greatly appreciated.