hi everybody
i got this page form some template that shows items in the page with pagination system but i want to keep this method without any pagination i dont want to spilit number of items i just wanna see all of the items that it read from db in the page without any pagination system . please help me here is the code of page

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<?php 
include "../../db.php";
?>
<?php
error_reporting(0);
//Rows
$imgRow = '<tr>';
$idRow = '<tr>';

$nn=10; //Number of items, we split this later

$s=mysql_query("SELECT * FROM `products`");

$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=\"0\" align=\"center\" style=\"text-align:center;\">";
$sql=mysql_query("SELECT * FROM `products` ORDER BY `id` DESC LIMIT $ss,$nn");
$inc = 0;
while($r=mysql_fetch_array($sql)){
    $key=$r['id'];
    $id=$r['name'];  
    $img=$r['pic1'];
    if($inc == 0){
        $imgRow .= "<tr>";
        $idRow .= "<tr>";
    }
    $imgRow .= "<td title=\"مشاهده جزئیات محصول\"><a href=\"showproducts1-details.php?id=$key\" target=\"_self\" ><img src=\"../admin/products/productimages1/$img\" width=\"139\" height=\"122\" border=\"1\" /></a></td>";
    $idRow .= "<td><a href=\"showproducts1-details.php?id=$key\">$id</a></td>";
    ++$inc;
    if($inc == 5 || $inc == 12 || $inc == mysql_num_rows($sql)){
        //Display Table
        echo $imgRow."</tr>";
        echo $idRow."</tr>";
        echo "</table>";
        echo "<br>";echo "<br>";echo "<br>";
        //To remove extra table
        if(mysql_num_rows($sql) <= 5){
            $inc = 11;
        }

        //Reset
        if($inc == 5){
            echo "<table border=\"0\" align=\"center\" style=\"text-align:center;\">";
            $imgRow = "<tr>";
            $idRow = "<tr>";
        }
    }
}
echo "</table>";
echo "<br>";
?>  </td>
  </tr>
</table>

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<?php
$j=0;
echo"تعداد صفحات : ";
for($i=1;$i<=$cc;$i++){
    echo"<a href=\"showproducts1-1.php?ss=$j\">$i</a>";
    echo"|";
    $j=$j+$nn; 
}
?>
</td>
  </tr>
</table>

Recommended Answers

All 4 Replies

In your code above
I have changed line number 36.
I have commented 80-86 lines.

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<?php 
include "../../db.php";
?>
<?php
error_reporting(0);
//Rows
$imgRow = '<tr>';
$idRow = '<tr>';

$nn=10; //Number of items, we split this later

$s=mysql_query("SELECT * FROM `products`");

$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=\"0\" align=\"center\" style=\"text-align:center;\">";
$sql=mysql_query("SELECT * FROM `products` ORDER BY `id` DESC ");
$inc = 0;
while($r=mysql_fetch_array($sql)){
    $key=$r['id'];
    $id=$r['name'];  
    $img=$r['pic1'];
    if($inc == 0){
        $imgRow .= "<tr>";
        $idRow .= "<tr>";
    }
    $imgRow .= "<td title=\"مشاهده جزئیات محصول\"><a href=\"showproducts1-details.php?id=$key\" target=\"_self\" ><img src=\"../admin/products/productimages1/$img\" width=\"139\" height=\"122\" border=\"1\" /></a></td>";
    $idRow .= "<td><a href=\"showproducts1-details.php?id=$key\">$id</a></td>";
    ++$inc;
    if($inc == 5 || $inc == 12 || $inc == mysql_num_rows($sql)){
        //Display Table
        echo $imgRow."</tr>";
        echo $idRow."</tr>";
        echo "</table>";
        echo "<br>";echo "<br>";echo "<br>";
        //To remove extra table
        if(mysql_num_rows($sql) <= 5){
            $inc = 11;
        }

        //Reset
        if($inc == 5){
            echo "<table border=\"0\" align=\"center\" style=\"text-align:center;\">";
            $imgRow = "<tr>";
            $idRow = "<tr>";
        }
    }
}
echo "</table>";
echo "<br>";
?>  </td>
  </tr>
</table>

<table width="750" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
<?php
$j=0;
echo"تعداد صفحات : ";
/*
for($i=1;$i<=$cc;$i++){
    echo"<a href=\"showproducts1-1.php?ss=$j\">$i</a>";
    echo"|";
    $j=$j+$nn; 
}*/
?>
</td>
  </tr>
</table>

it doesnt work !!!!!!!
you know i want to display all of my items without pagination in your code you just remove limit ... i wanna show all of the items in the page in each rows 5 items and then next row but the important point is i wanna display all of the items in one page not with pagination also in each row i wanna display just five items then going to next row and so on ... please help me with this problem

please help me with this problem !!!!

is there any way to create 3 rows for display items ?
in this code i changed $nn and other variables and now i got 4 items in my page in each rows totally 8 items - 4 item in row 1 and 4 item in row 2 !
so is there any way to create row 3 with 4 item on it ? it is possible too doing my work !
help me !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.