deleted user 111213 Grandmaster Cheater Reputation: 0
Joined: 09 Nov 2007 Posts: 714
Posted: Sat Dec 06, 2008 4:10 am Post subject: problem with showing topics!
Code:
<?php
include "(../global.php)";
function isInteger($input){
return preg_match('@^[-]?[0-9]+$@',$input) === 1;
}
function ShowTopics($forumid){
$sql = "SELECT * FROM `forum_topics` WHERE `cid`=$forumid";
$res = mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($res) == 0){
echo "There are no topics in this forum, <a href=\"../forum-index.php?act=create&id=" . $forumid . "\">click here</a> to create a topic!\n";
} else {
echo "<table border=\"0\" cellspacing=\"3\" cellpadding=\"3\">\n";
echo "<tr align=\"center\"><td>Title</td><td>User</td><td><Date</td><td>Replies</td></tr>\n";
while($row2 = mysql_fetch_assoc($res)){
#$sql3 = "SELECT count(*) AS num_replies FROM forum_replies WHERE tid='".$row2['id']."'";
#$res3 = mysql_query($sql3) or die(mysql_error());
$row3 = mysql_fetch_assoc($res3);
echo "<tr><td><a href=\"./forum-index.php?act=topid&id="$row2['id']."\">".s($row2['title'])."</a></td><td>".uid($row2['uid'])."</td><td>".$row2['date']."</td><td>".$row3['num_replies']."</td></tr>\n";
}
echo "</table>\n";
}
}
$id = $_GET['id'];
if(isInteger($id)){
$sql1 = "SELECT * FROM `forum_sub_cats` WHERE `id`=$id";
$res1 = mysql_query($sql1) or die(mysql_error());
if(mysql_num_rows($res1) == 0){
echo "The forum sub category you supplied does not exist!\n";
} else {
$row = mysql_fetch_assoc($res1);
if($row['admin'] > 0){
if($admin_user_level > 0){
ShowTopics($row['id']);
} else {
echo "You must be an admin to view this forum!\n";
}
} else {
ShowTopics($row['id']);
}
}
}
?>
doesn't show anything. i have fixed like the problem where it says that they don't exist when they do, but now i have a problem when the topics i made don't show up.
Joined: 09 Mar 2007 Posts: 1417 Location: sitting outside of the forum
Posted: Sat Dec 06, 2008 7:47 am Post subject:
Not again dude. Seriously, you need to LEARN PHP and MySQL before you come here. This is a place for specific issues and problems not a place to get other programmers and developers to just do stuff for you. _________________
deleted user 111213 Grandmaster Cheater Reputation: 0
Joined: 09 Nov 2007 Posts: 714
Posted: Sat Dec 06, 2008 8:17 am Post subject:
i already requested lock like hours ago cause i figured it out like straight away, but it don't matter now, cause i nearly finished except one small error.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum