Web Hosting Talk







View Full Version : Weird issues


ForgottenTech
07-18-2005, 04:09 AM
For some reason the php code on my site used to display the news in my forums is acting up. It's posting replies for some topics as actual news. If someone would mind taking a look at it I would be greatfull. You can message me on messenger for the index.php file. The issue it's doing can be found here www.deadlyservers.com. Notice the first news post is showing replies whereas the others don't.. Check my profile for messenger info.


Sorry if this is the wrogn forum..

ForgottenTech
07-18-2005, 04:27 AM
The code looks like the following


<?php
if($_GET["subcat"] == "")
{

$connect =mysql_connect ("localhost", "forumname", "password") or die("Error @ query 1 ".mysql_error());
mysql_select_db ("forum");

$result = mysql_query("SELECT topic_id,topic_replies FROM phpbb_topics WHERE forum_id='1' ORDER BY topic_time DESC LIMIT 1") or die("Error @ query 2 ".mysql_error());
$top = mysql_fetch_object($result);

$result = mysql_query("SELECT * FROM phpbb_posts WHERE topic_id='".$top->topic_id."'") or die("Error @ query 2 ".mysql_error());
$post = mysql_fetch_object($result);

$result = mysql_query("SELECT * FROM phpbb_posts_text WHERE post_id='".$post->post_id."'") or die("Error @ query 3 ".mysql_error());
$post_text = mysql_fetch_object($result);

$result = mysql_query("SELECT username,user_id FROM phpbb_users WHERE user_id='".$post->poster_id."'") or die("Error @ query 4 ".mysql_error());
$user = mysql_fetch_object($result);

?>
<b><?php echo $post_text->post_subject; ?></b><br>
Posted by <a target="_blank" href="http://www.deadlyservers.com/forums/profile.php?mode=viewprofile&u=<?php echo $user->user_id; ?>"><?php echo $user->username; ?></a><br><br>
<?php echo $post_text->post_text; ?>
<br>
&nbsp; >>
<a target="_blank" href="http://www.deadlyservers.com/forums/viewtopic.php?t=<?php echo $top->topic_id; ?>">Read More/Respond</a> (<?php echo $top->topic_replies; ?> replies total)
</table>
<?php