0

I know m asking it again maybe but i tried the questions available on pagination but couldnt understand dem properly ... need to know the way to paginate the results of the following query :

$query = "SELECT * FROM info WHERE Cat1 = 'novel'";
$result = mysql_query($query);
if (!$result) die ("DAtabase acces faild bc : ". mysql_error());

echo " <ul class=listbkwide2>";

while($data = mysql_fetch_object($result))
{
$id = $data->id;
$name = $data->Bname ;
$continent = $data->Bauthor;

    echo "  <li class=bkd><a href='details.php?bid=$id'> 
         <img src='images/sbs/$name.jpg'  title='$name' alt=''>
      <ul class=showcasetitle> <span> $name </span> </ul>
       <p class=authname> By    <span> $continent</span></p>  
      ";
}
echo " </ul> ";
ini_set('display_errors', '1');
mysql_close();
1
  • Pagination is all in your query. Consider how you can SAFELY accept request parameters to drive a LIMIT statement or an additional WHERE clause to control the scope of your returned recordset. Commented Sep 18, 2012 at 0:05

1 Answer 1

1

You need to maintain the offset and then add a LIMIT clause to your query.

[LIMIT {[offset,] row_count | row_count OFFSET offset}]

See the doc.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.