Jump to content

Paging Issue


Zepo.

Recommended Posts

http://www.eliteladders.com/devlopment/index.php

After page 1 no info is in the articles....

I cant figure out why

Any help woul be greatly appreciated

 

 

$dblink = mysql_connect($host, $user, $password)  or die('Could not connect');
mysql_select_db($db) or die('Unable to select database!');

if(!$page){
$page="1";
}
$page=($page - 1);

$total=mysql_query("SELECT COUNT(*) FROM news");
$total=mysql_fetch_array($total);
$total="$total[0]";

$query_new = "SELECT * FROM news ORDER BY `id` DESC  LIMIT $page , $config[shownews]";
$result_new = @mysql_db_query($db, $query_new, $dblink) or die(mysql_error());
while($links = mysql_fetch_array($result_new)) {
$id = $links["id"];

$output=mysql_query("SELECT *,DATE_FORMAT(date,'%M-%d-%Y') as \"DatE\" FROM news WHERE id='$id' ORDER BY `id` DESC  LIMIT $page, $config[shownews]");
$output=mysql_fetch_array($output);

$totalc=mysql_query("SELECT COUNT(*) FROM comments WHERE cgroup='1' AND comted='$output[id]'");
$totalc=mysql_fetch_array($totalc);
$totalc="$totalc[0]";

if ($news=""){
$out[news].="<center><table border='0' width='90%'>
      <tr>                          
        <td width='100%' valign='top'><table border='0' width='100%'
        cellpadding='2' bgcolor='#000000' cellspacing='1'><center>
          <tr>
            <td width='100%' colspan='2' bgcolor='$config[altcolor]'
            background='$config[bg]'><p align='center'><b>No Current News</b></td>
          </tr>
          <tr>
            <td width='100%' colspan='2' bgcolor='$config[altcolor]'>»
            There is no current news, you may add news via the Admin Control Panel. </td>
          </tr>
        </table>
        </td>
      </tr>
    </table>
<br></center>";
}else{
$staff=mysql_query("SELECT * FROM staff WHERE name='$output[staff]'");
$staff=mysql_fetch_array($staff);


if(!$staff[ava]){
$staff[avatar]="";
}else{
$staff[avatar]="<img src='$staff[ava]' border='0'>";
}

if(!$staff[sn]){
$staff[aim]="";
}else{
$staff[aim]="<a href='aim:goim?screenname=$staff[sn]&message=Hello, Are You There?'><img src='http://big.oscar.aol.com/$staff[sn]?on_url=$config[sitelink]/images/aim.gif&off_url=$config[sitelink]/images/aimoff.gif'  border='0' align='absmiddle'></a>";
}

if(!$staff[email]){
$staff[mail]="";
}else{
$staff[mail]="<a href='mailto:$staff[email]'><img src='./images/email.gif' border='0' /></a>";
}

$out[news].="<center><table border='0' width='87%'>
      <tr>                          
        <td width='100%' valign='top'><table border='0' width='100%'
        cellpadding='2' bgcolor='#000000' cellspacing='1'><center>
          <tr>
            <td width='100%' colspan='2' bgcolor='$config[altcolor]'
            background='$config[bg]'><p align='center'><a href='./index.php?article=$output[id]'><b>$output[title]</b></a></td>
          </tr>
          <tr>
    <td width='25%' bgcolor='$config[altcolor]'><center><b><a href='./staff.php?profile=$staff[id]'><font color='red'>$output[staff]</font></a></b><br />
    $staff[avatar]<br />
    <i>$staff[title]</i><br />$staff[aim]
            $staff[mail]</center></td>
            <td width='75%' bgcolor='$config[altcolor]' valign='top'><div align='left'>»$output[news]</div></td>
          </tr>
          <tr>
            <td width='100%' colspan='2' bgcolor='$config[altcolor]'>$totalc Comments - Posted On $output[date]</td>
          </tr>
        </table>
        </td>
      </tr>
    </table>
<br></center>";
}
}
$pagenow=($page + 1);

$pages=1;
if($pagenow==1){
$skipranks.="[$pages] ";
}else{
$skipranks.="<a href='$config[scripturl]/index.php?page=1'>$pages</a> ";
}

$arank=1;
$brank=$config[shownews];

while($brank < $total){
$arank=($arank + $config[shownews]);
$brank=($brank + $config[shownews]);
$pages++;

if($pagenow==$arank){
$skipranks.="[$pages] ";
}else{
$skipranks.="<a href='$config[scripturl]/index.php?page=$arank'>$pages</a> ";
}
}
$out[news].="<center>$skipranks</center><br />";

Link to comment
Share on other sites

Check out the pagination tutorial that is here on the PHPfreaks webpage.

Also, ive noticed that (on your page) when i go to page 2, the URL reads page=6, and on page 3, the url reads page=11..

 

I suggest you just completly re-code a pagination script instead of trying to fix the one you have now, it'd be way more organized.

 

I can code you one in less than an hour if you dont feel like following the tutorial or coding one yourself, PM me for information.

Link to comment
Share on other sites

post again your codes having comment on each line that will tell us what does each line do ...

 

i have seen some lines here that i think you dont need  or need some fixes.. and where is the part that gets the query string data i mean the global get variable

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.