Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Help with pagination....
Old 03-29-2005, 06:07 AM Help with pagination....
Junior Talker

Posts: 1
Trades: 0
Hi could some please help me... I am creating a pagination system for a online forum and the pagination works fine for when i output the topics and the pages also work fine.

However when i try to create the pagination system for the various replies within a particular subject heading. The system does not work. The topic_id which is the id for a particular topic is passed in through the URL when the user clicks on the hyperlink of the subject.

The pages seem to echo fine but when i go to another page apart from the first one nothing is displayed.

Could someone please have a look at the following code and see where am going wrong... Any help is truely appreciated.....

PHP Code:

$data = $_GET['id']; 

$update_views = mysql_query("UPDATE forum_topic SET topic_views = topic_views + 1 WHERE topic_id = $data"); 
$test = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$data' ORDER BY post_time ASC"); 
$num_rows = mysql_num_rows($test); 

setcookie("tester", "$data"); 
$salma .= $data; 

$SQL = mysql_query("SELECT COUNT(*) AS Total FROM forum_posts WHERE topic_id = '$salma' ORDER BY post_time ASC"); 

$SQL_Result_Array = mysql_fetch_array($SQL); 
$Total = $SQL_Result_Array['Total']; 
$Result_Set = 0; 
$per_page = 3; 

if (empty($_GET['Result_Set'])) 

$Result_Set = 0; 

$SQL2 = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$salma' LIMIT $Result_Set, $per_page"); 
echo "<br>"; 



else { 
$Result_Set = $_GET['Result_Set']; 
$SQL2 = mysql_query("SELECT * FROM forum_posts WHERE topic_id = '$salma' LIMIT $Result_Set, $per_page "); 

?> 

<tr> 
<table width="65%" border="0" cellspacing="2" cellpadding="5" bgcolor="white" div align = "center"> 
<td width="25%" bgcolor="#990033"><font size="3" face="<?php echo $default_font?>" color="#FFFFFF"><b>Posted</b></font></td> 
<td width="75%" bgcolor="#990033"><font size="3" face="<?php echo $default_font?>" color="#FFFFFF"><b><?php echo subject ?></b></font></td> 
</tr> 
<br><br> 
<?php 

for ($a 0$a <= $Total$a++) { 

$SQL_Array mysql_fetch_array($SQL2); 

$topic_title $SQL_Array['topic_title']; 
$post_text $SQL_Array['post_text'];?> 

<td> <?php echo $topic_title?> 
<td> <?php echo $post_text
echo 
"<tr>"?> 
<?php 


if (
$Total 0) { 

if (
$Result_Set $Total && $Result_Set 0) { 
$Res1 $Result_Set $per_page
echo 
"<A HREF=\"$self?Result_Set=$Res1\">Prev</A> "


$Pages $Total $per_page

if (
$Pages 1) { 

for (
$b=0$c=1$b $Pages$b++, $c++) { 

$check $b $per_page
if (
$check == $Result_Set) { 
echo 
"<b>".$c."&nbsp;</b>"


if (
$check != $Result_Set) { 
$Res1 $per_page $b
echo 
"<A HREF=\"$self?Result_Set=$Res1\">$c</A>&nbsp; "
}

Last edited by 0beron; 03-29-2005 at 08:26 AM.. Reason: Added [php ] tags
faisal is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Help with pagination....
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11391 seconds with 12 queries