hi
i create a page that select 6 item form certain table in database and then in each page it shows 6 item of them order by id desc and now i decided to increase the number of item for displaying in each pages to 12.
so the question is here how can i change the code for showing 12 items in each page instead of 6 item.
please help me with this .
<?php
include "db.php";
//Rows
$qtyRow = '<tr>';
$priceRow = '<tr>';
$nn=6; //Number of items, we split this later
$s=mysql_query("SELECT * FROM `test1`");
$c=mysql_num_rows($s);
if($c%$nn==0){
$cc=$c/$nn;
}else{
$cc=$c/$nn+1;
}
//$cc : Number of pages
$ss=@$_REQUEST['ss']; //Start position (eg: 6)
$other_tables = "";
if($ss=="" || $ss==null){
$ss = 0; //Set to zero because it is incremented later
}
//Pages
echo "<table border=\"1\" align=\"center\">";
$sql=mysql_query("SELECT * FROM `test1` ORDER BY `id` DESC LIMIT $ss,$nn");
$inc = 0;
while($r=mysql_fetch_array($sql)){
$id=$r['id'];
$name=$r['name'];
if($inc == 0){
$qtyRow .= "<tr>";
$priceRow .= "<tr>";
}
$qtyRow .= "<td>$id</td>";
$priceRow .= "<td>$name</td>";
++$inc;
if($inc == 3 || $inc == 6 || $inc == mysql_num_rows($sql)){
//Display Table
echo $qtyRow."</tr>";
echo $priceRow."</tr>";
echo "</table>";
//To remove extra table
if(mysql_num_rows($sql) <= 3){
$inc = 7;
}
//Reset
if($inc == 3){
echo "<br><table border='1' align='center'>";
$qtyRow = "<tr>";
$priceRow = "<tr>";
}
}
}
echo "</table>";
$j=0;
echo"page : ";
for($i=1;$i<=$cc;$i++){
echo"<a href=\"select.php?ss=$j\">$i</a>";
echo"|";
$j=$j+$nn;
}
?>