gevans Posted December 6, 2008 Share Posted December 6, 2008 try using the code like this <?php $_GET['id']; $page = (!$_GET['page'] || $_GET['page'] < 0) ? "1" : $_GET['page']; $page = ceil($page); $limit = 10; $start = $limit; $end = $page*$limit-($limit); if(isset($_GET['id'])){ $sql = "SELECT * FROM forum_topics WHERE id='$id'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "This topic does not exist!\n"; } else { $row = mysql_fetch_assoc($res); $sql2 = "SELECT admin FROM forum_sub_cats WHERE id='$row['cid']'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if($row2['admin'] && !$admin_user_level){ echo "You cannot view this topic because you are not an admin!\n"; } else { $a = (isa($row['uid'])) ? "<font style=\"color:#800000;\">ADMIN</font>" : ""; echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<tr><td colspan=\"2\" align=\"left\" class=\"forum_header\"><b><font size=\"3\">".$row['title']."</font></b><font size=\"3\"> - Posted On: <em>".$row['date']."</em></font></td></tr>\n"; echo "<tr><td align=\"left\" width=\"15%\" valign=\"top\" class=\"forum_header\">".uid($row['uid'], true)."<br>Posts: 0<br>".$a."</td>"; echo "<td align=\"left\" valign=\"top\" class=\"forum_header\">"; echo topic($row['message']); echo "</td>\n"; echo "</tr>\n"; $amount_check = "SELECT * FROM forum_replies WHERE tid='$id'"; $amount_check_res = mysql_query($amount_check) or die(mysql_error()); $amount_count = mysql_num_rows($amount_check_res); $pages = ceil($amount_count/$limit); $previous = ($page-1 <= 0) ? "« Prev" : "<a href=\"./forum-index.php?act=topic&id=".$id."&page=".($page-1)."\">« Prev</a>"; $nextpage = ($page+1 > $pages) ? "Next »" : "<a href=\"./forum-index.php?act=topic&id=".$id."&page=".($page+1)."\">» Next</a>"; echo "<tr><td align=\"right\" colspan=\"2\">\n"; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href=\"./forum-index.php?act=topic&id=".$id."&page=".($page)."\">".$page."</a>"; echo $href; } echo $nextpage; echo "</td></tr>\n"; $select_sql = "SELECT * FROM forum_replies ORDER BY id ASC LIMIT $end, $start"; $select_res = mysql_querty($select_sql) or die(mysql_error()); echo "<form method=\"post\" action=\"./forum-index.php?act=reply&id=".$row['id']."\">\n"; echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:90%\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"add reply!\" style=\"width:90%\" /></td></tr>\n"; echo "</table>\n"; } } } else { echo "Please view a valid topic!\n"; } ?> Link to comment https://forums.phpfreaks.com/topic/135796-need-help-with-my-replyphp/page/2/#findComment-707994 Share on other sites More sharing options...
Noskiw Posted December 6, 2008 Author Share Posted December 6, 2008 still didn't work! Link to comment https://forums.phpfreaks.com/topic/135796-need-help-with-my-replyphp/page/2/#findComment-707997 Share on other sites More sharing options...
gevans Posted December 6, 2008 Share Posted December 6, 2008 A little more info than still didn't work! would help!!! If it doesn't work tell me what it's doing, even if it's doing the same thing just say its showing the nav and notheing else (if that is the case) Link to comment https://forums.phpfreaks.com/topic/135796-need-help-with-my-replyphp/page/2/#findComment-707999 Share on other sites More sharing options...
Noskiw Posted December 6, 2008 Author Share Posted December 6, 2008 A little more info than still didn't work! would help!!! If it doesn't work tell me what it's doing, even if it's doing the same thing just say its showing the nav and notheing else (if that is the case) your right, still just showing the navigation. ill give u the details to my account so u can edit it personally. Link to comment https://forums.phpfreaks.com/topic/135796-need-help-with-my-replyphp/page/2/#findComment-708006 Share on other sites More sharing options...
Noskiw Posted December 6, 2008 Author Share Posted December 6, 2008 this is the code now3 i fixed it <?php $id = $_GET['id']; $page = (!$_GET['page'] || $_GET['page'] < 0) ? "1" : $_GET['page']; $page = ceil($page); $limit = 10; $start = $limit; $end = $page*$limit-($limit); if(isset($id)){ $sql = "SELECT * FROM forum_topics WHERE id='".$id."'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "This topic does not exist!\n"; }else{ $row = mysql_fetch_assoc($res); $sql2 = "SELECT admin FROM forum_sub_cats WHERE id='".$row['cid']."'"; $res2 = mysql_query($sql2) or die(mysql_error()); $row2 = mysql_fetch_assoc($res2); if($row2['admin'] == 1 && $admin_user_level == 0){ echo "You cannot view this topic because you are not an admin!\n"; }else{ $a = (isa($row['uid'])) ? "<font style=\"color:#800000;\">ADMIN</font>" : ""; echo "<table border=\"0\" width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">\n"; echo "<tr><td colspan=\"2\" align=\"left\" class=\"forum_header\"><b><font size=\"3\">".$row['title']."</font></b><font size=\"3\"> - Posted On: <em>".$row['date']."</em></font></td></tr>\n"; echo "<tr><td align=\"left\" width=\"15%\" valign=\"top\" class=\"forum_header\">".uid($row['uid'], true)."<br>Posts: 0<br>".$a."</td>"; echo "<td align=\"left\" valign=\"top\" class=\"forum_header\">"; echo topic($row['message']); echo "</td>\n"; echo "</tr>\n"; $amount_check = "SELECT * FROM forum_replies WHERE tid='".$tid."'"; $amount_check_res = mysql_query($amount_check) or die(mysql_error()); $amount_count = mysql_num_rows($amount_check_res); $pages = ceil($amount_count/$limit); $previous = ($page-1 <= 0) ? "« Prev" : "<a href=\"./forum-index.php?act=topic&id=".$id."&page=".($page-1)."\">« Prev</a>"; $nextpage = ($page+1 > $pages) ? "Next »" : "<a href=\"./index.php?act=topic&id=".$id."&page=".($page+1)."\">Next »</a>"; echo "<tr><td align=\"right\" colspan=\"2\">\n"; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href=\"./index.php?act=create&id=".$i."\">".$i."</a> "; echo $href; } echo $nextpage; echo "</td></tr>\n"; $select_sql = "SELECT * FROM `forum_replies` ORDER BY id ASC LIMIT ".$end.",".$start.""; $select_res = mysql_query($select_sql) or die(mysql_error()); while($rowr = mysql_fetch_assoc($select_res)){ echo "<tr><td colspan=\"2\" align=\"left\" class=\"forum_header\"><font size=\"3\"> - Posted On: <em>".$rowr['date']."</em></font></td></tr>\n"; echo "<tr><td align=\"left\" width=\"15%\" valign=\"top\" class=\"forum_header\">".uid($rowr['uid'], true)."<br>Posts: 0<br>".$a."</td>"; echo "<td align=\"left\" valign=\"top\" class=\"forum_header\">"; echo topic($rowr['message']); echo "</td>\n"; echo "</tr>\n"; } echo "<form method=\"post\" action=\"./forum-index.php?act=reply&id=".$row['id']."\">\n"; echo "<tr><td colspan=\"2\" align=\"center\"><textarea style=\"width:90%\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"add reply!\" style=\"width:90%\" /></td></tr>\n"; echo "</table>\n"; } } }else{ echo "Please view a valid topic!\n"; } ?> sad trouble is, my pagination isn't working! the numbers don't show up in other words! Link to comment https://forums.phpfreaks.com/topic/135796-need-help-with-my-replyphp/page/2/#findComment-708052 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.