-
Posts
289 -
Joined
-
Last visited
Everything posted by Noskiw
-
the pages keep on going, how do i make html entities work? like the ampersand (&) and the < and >. cause i don't know how to yet. also, i saw the posts you put, i will work on it. and what i mean by the pages keep on going, when it goes to &page=2, it carries on forever, i went all the way to 100 and it was still there.
-
i have tried the one that you gave me, all it did was seperate the next and prev, the page number doesn't show up and the link still isn't there. i think i need to get rid of the question mark.
-
the number of the page wont show up, ill show you here http://nostrich.freetzi.com/forum-index.php?act=topic&id=21 add &page=2 to the end of that link and it will go to the next page.
-
ok now it's working this is it now $select_sql = "SELECT * FROM `forum_replies`WHERE tid = ".$id." ORDER BY id ASC LIMIT ".$end.", ".$start.""; but now onto the pagination problem, i can't seem to get the number to show up, + the fact the the next link wont show up.
-
even more You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY id ASC' at line 1 SELECT * FROM `forum_replies` WHERE tid=21 LIMIT 0, 10 ORDER BY id ASC
-
this again You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ORDER BY id ASC' at line 1 res
-
comes up with this You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' ORDER BY id ASC' at line 1
-
forum_replies structure id: int(11) primary key auto_increment tid: int(11) uid: int(11) message: text date: varchar(64) time: int(25)
-
there are 10 replies in one and 3 in the other.
-
that sort of works but only returns one reply.
-
i don't get what yuo are saying.
-
but i don't know where to add the where statement maybe it could be $select_sql = "SELECT * FROM `forum_replies` ORDER BY id ASC LIMIT WHERE id= ".$end.",".$start."";
-
<?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=\"./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"; } ?> the problem is that the replies show up in both topics, theyre not meant to. and the page number and links to the next page wont show up.
-
so how would i change this so it fits mine?? cause i really don't know how. i've tried something but no page things come up.
-
yea thats all helpful, but i don't know how to change it so it fits into my page. and i don't want 2 seperate files for one part.
-
i can't make a new db or table cause i only get a few on the server i'm working on. could you help me, say like edit bits of the code, just to help me a little, please?
-
bump still need help.
-
anyone? please help, i am so close to finishing my forum. i just want to finish it so my mates can use it in school.
-
here is my topic.php script <?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=\"./forum-index.php?act=topic&id=".$id."&page=".($page+1)."\">Next »</a>"; echo "<tr><td align=\"right\" colspan=\"2\" class=\"forum_header\">\n"; echo "Pages: "; echo $previous; for($i=1;$i<=$pages;$i++){ $href = ($page == $i) ? " ".$i." " : " <a href=\"./pagetest.php?page=".$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()); 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"; } ?> it comes out without the page number and no link to the next page.
-
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!
-
your right, still just showing the navigation. ill give u the details to my account so u can edit it personally.
-
still didn't work!
-
On the web page, in the browser nope, no line!