Jump to content


Photo

pagination problems PLEASE PLEASE HELP ME !!!!!!!


  • Please log in to reply
2 replies to this topic

#1 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 11 September 2006 - 05:20 AM

i have this code that displays all your friends bullletins.. and it limits 5 per page.. well its supposed to .. lets say there are 7 bulletins posted.. it shows all 7 on one page.. but says there are 2 pages of bulletins, like tis supposed to.. idk whats wrong.... you see anything?!?!?!??!!?


<?php
$query="SELECT * FROM friends WHERE `username` = '$_SESSION[username]' AND `accepted` = 'yes'";
$result=mysql_query($query);
while($array=mysql_fetch_assoc($result)){
$poster = $array['friend'];

$user = $_SESSION[username];

if(!isset($_GET['bulletinPage'])){ 
    $Bpage = 1; 
} else { 
    $Bpage = $_GET['bulletinPage']; 
} 

$max_results = 5; 


$from = (($Bpage * $max_results) - $max_results); 

$query2="SELECT * FROM `bulletins` WHERE `from` = '$poster' ORDER by 'id' DESC LIMIT $from, $max_results";

$result2=mysql_query($query2);

while($array=mysql_fetch_assoc($result2)){

echo "<table bgcolor=#99CCFF width=200><tr bgcolor=#548099><td height=28><b><font color=white>From: <a href='getInfo.php?user=" . $array['from'] . "'>" . $array['from'] . "</a></b><br><b>Date: </b>" .$array['date'];
 echo "</b></font></td></tr></table>";
 echo "<table bgcolor=#99CCFF width=200><tr bgcolor=#356B8B><td height=25><center><a href=\"showBulletin.php?id=".$array['id']."\">Subject:  ".$array['subject']."</a></center>";
  echo "</td></tr></table><hr>";
 }
}

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM bulletins WHERE `from` = '$poster'"),0); 

$total_pages = ceil($total_results / $max_results); 
?>
<b>Page: </b>
<?php
if($Bpage > 1){ 
    $prev = ($Bpage - 1); 
    echo "<a href=\"".$_SERVER['PHP_SELF']."?bulletinPage=$prev\"></a>"; 
 } 
for($i = 1; $i <= $total_pages; $i++){ 
    if(($Bpage) == $i){ 
        echo "$i "; 
        } else { 
            echo "<a href=\"".$_SERVER['PHP_SELF']."?bulletinPage=$i\">$i</a> "; 
    } 
} 

if($Bpage < $total_pages){ 
    $next = ($Bpage + 1); 
    echo "<a href=\"".$_SERVER['PHP_SELF']."?bulletinPage=$next\"></a>";

} 
?>

Link shortener with advanced, detailed statistics:

http://tyny.us/

#2 techiefreak05

techiefreak05
  • Members
  • PipPipPip
  • Advanced Member
  • 494 posts
  • LocationER, MN

Posted 11 September 2006 - 05:28 AM

please please take a look!! im really really in a bad time to have it not working!!
Link shortener with advanced, detailed statistics:

http://tyny.us/

#3 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 11 September 2006 - 05:30 AM

Please do not bump your request so soon after posting it. If you must bump it wait at least 4 to 8 hours.

Ken




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users