Dingbats
; Send PM
 Posts: 1970
Threads: 50 Mood: Optative Money: �268.57 (D) (+ Friend) 
                  
|
I'm making a forum for my site, and for the pagination at the page that shows the threads (forumview.php), I have followed this tutorial. But it doesn't work! Maybe it's because I use joins for selecting all the stuff I need, but I have no clue how I would solve the problem.
The table with the threads in is called f_threads, and the table with the posts in (including the first) is called f_posts.
This is the code for the pagination (tabs don't seem to work well):
\n
if(isset($_GET["page"])) //forumview.php?id=1& page=1, for ex.
{
$page = $_GET["page"];
$limit = 3; //A weird limit, just for testing
$lstart = $page * $limit - ($limit);
}
else
{
$page = 1;
$limit = 3;
$lstart = $page * $limit - ($limit);
}
$sql = "SELECT f_threads.*, f_posts.date, f_posts.thread FROM f_threads INNER JOIN f_posts ON f_posts.thread = f_threads.id AND f_threads.forum = ".$_GET['id']." ORDER BY date DESC LIMIT ".$lstart.", ".$limit; //Selecting everything I need to output later, isn't shown in this part of the page
$result = mysql_query("$sql");
$sqlc = "SELECT COUNT(*) FROM f_threads"; //FROM HERE
$resultc = mysql_query("$sqlc");
$totalrows = mysql_num_rows($resultc); //TO HERE is what I think messes things up
echo $totalrows.""; //I echoed $numofpages just to see what it is
?>\n
What is wrong with this? I have followed the tutorial perfectly well.
Can you help?
Post Reply
         Donate to BlameThePixel:

[22 Queries, Page Loaded in 0.428033 Seconds]
|
|
Your Comments: