Forum Moderators: coopster

Message Too Old, No Replies

Adding Pages to a Php Forum. need help

php forum pages

         

sw0o0sh

11:34 pm on Sep 29, 2006 (gmt 0)

10+ Year Member



Alright, this will be sort of hard for me to explain, but anyway I've been working on my own self coded forum [ 850 lines so far :) ]

But anyway, this is the part where I always fall short. I was able to generate links to each page, .. Ill provide examples..

Alright, say a specific thread has 23 replies. That means in order for a topic displaying 10 replies a page, that 3 pages of that topic would display all 23 replies. So far I made my forum able to display them links..

ex..
Select Page:
forum.php?cat=id&top=id&page=1'>1</a>
forum.php?cat=id&top=id&page=2'>2</a>
forum.php?cat=id&top=id&page=3'>3</a> etc...

See what I mean? Basically I got it to array that.

And heres the coding I did to do just that..

------------------------
$repliez = mysql_query("
SELECT * FROM pid WHERE tid='$_GET[top]'
and cid='$_GET[cat]'");

$thetotal = mysql_num_rows($repliez);

echo"
<tr>
<td align='center'> Select Page:
";

$g=0;
$m=1;
$numpage=ceil($thetotal/10);
while($g < $numpage)
{
echo"<a href='forum.php?act=viewthread&cat=$_GET[cat]&top=$_GET[top]&page=$m'>$m</a>&nbsp;";
$g++;
$m++;
}
------------------------

Now, I'm trying to make them &page=num try to signal the mysql query so the sql query will GRAB for instance, LIMIT 0, 10 on the query shows Replies 0-10, LIMIt 10, 10 shows replies 11-20, and LIMIT 20, 10 shows replies 20 - 30.

But i'm stumped....

I can't play with all the variables inorder to make an automatic query, it's way out of my reach at least for now.

Heres the query im working with.. (This query displays replies on a thread, in this specific one it'd display the first 10 replies to a topic)
------------------------
$replies = mysql_query("
SELECT * FROM pid WHERE tid='$_GET[top]'
and cid='$_GET[cat]' ORDER BY id ASC LIMIT 0 , 10");
------------------------
I want the limit 0, 10 to automatically do 10, 10, - 20, 10, etc.. with the while effect.. but I am unsure how... Anyone get what I am trying to say (i'd be amazed.. thanks)

sw0o0sh

12:21 am on Sep 30, 2006 (gmt 0)

10+ Year Member



well, uh, i figured it out on my own after a few.

Don't waste your brain power trying to figure this guy out.