Jump to content

Trying to skip first row with Ps_Pagination


bramabull100

Recommended Posts

Hey guys,

 

I have been using this code for Pagination found at the following link: http://phpsense.com/php/php-pagination-script.html.

 

Now this calls up a class which uses a LIMIT function internally. So the code works great and is retrieving the results I want except I want to skip the first row it returns. Now I know this is generally a weird request but I want to skip the first row and start on the second. So instead of starting the while loop on row [0] I want it to start on row [1]. I hope I explained this clearly enough if not just let me know. Thanks for the help!

 

My Code:

 

                          <!-- THIS IS WHERE THE MAIN SUB CONTENT QUERY STARTS -->

                           

                          <?php

 

//Include the PS_Pagination class

include('ps_pagination.php');

//Connect to mysql db

$conn = mysql_connect('localhost', 'username', 'password');

mysql_select_db('test_db',$conn);

//$sql = 'SELECT * FROM articles WHERE article_type ="News" AND idarticles="70"  ORDER BY date_uploaded DESC';

 

 

//To sort it by certain article type

$sql = 'SELECT * FROM articles ORDER BY date_uploaded DESC';

 

 

//Create a PS_Pagination object

$pager = new PS_Pagination($conn, $sql, 8, 10, 'param1=valu1&param2=value2');

//The paginate() function returns a mysql

//result set for the current page

$rs = $pager->paginate();

//Loop through the result set

 

 

//DEFAULT SKIPS FIRST RECENT BECAUSE IT WILL DUPLICATE

 

while($row = mysql_fetch_assoc($rs)) {

 

echo "

 

<div id=\"left_lower_content\">

 

<div id=\"left_lower_content_top\"><p class=\"left_lower_content_top_class\">{$row['article_type']}</p></div>

 

<div id=\"left_lower_content_image\"><a href=\"view_article.php?id={$row['idarticles']}&lightbox[width]=950&lightbox[height]=700&lightbox[modal]=true\" class=\"lightbox\"><img name=\"left_lower_content_image\" src=\"{$row['article_big_image']}\" width=\"300\" height=\"170\" alt=\"\" style=\"background-color: #999999\"  /></a></div>

 

<div id=\"left_lower_content_main_text\">

 

<p class=\"left_lower_content_title lightbox\"><a href=\"view_article.php?id={$row['idarticles']}lightbox[width]=1000&lightbox[height]=200&lightbox[modal]=true\">{$row['article_title']}</a></p>

 

<p class=\"left_lower_content_text\">{$row['small_description']}</p>

 

</div>

 

<a href=\"view_article.php?id={$row['idarticles']}lightbox[width]=1000&lightbox[height]=200&lightbox[modal]=true\"><img src=\"images/full_article.jpg\" width=\"86\" height=\"15\" alt=\"full_article\" class=\"full_article_sub_article lightbox\" /></a>

 

<div id=\"left_lower_content_bottom_div\"><p class=\"left_lower_content_bottom\">Posted by: Felix Henriques | {$row['views']} Views | Posted on: {$row['date_uploaded']} | <a href=\"#\">{$row['comments']} Comments</a></p></div>

 

<div id=\"left_lower_spacer\"></div>

 

</div>

 

";

 

 

; }

//Display the navigation

echo'<div id="pagination">';

echo'<p class="pagination">';

echo $pager->renderFullNav();

echo'</p>';

echo'</div>';

 

 

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.