Jump to content

Pagination


raptor30506090

Recommended Posts

Hi guy seems to be having bit of trouble with this it gets first id then go's to pot when i hit the number 2 and so on nothing is there any help would be great

<?php
$per_page = 1;
$query = mysql_query("SELECT COUNT('id') FROM product");
$pages = ceil(mysql_result($query, 0) / $per_page);
$page = (isset($_GET['id']) AND (int)$_GET['id'] > 0) ? (int)$_GET['id'] : 1;
$start = ($page - 1) * $per_page;
?>
<?php 
if(isset($_GET['id'])){
               $id = $_GET['id'];
                   $query = mysql_query("SELECT * FROM product WHERE  productMenu=" . mysql_real_escape_string((int)$id) . " LIMIT {$start}, {$per_page}")or die(mysql_error());
			   
			   
			   while($row = mysql_fetch_assoc($query)){ ?>
                   <div id="productHolder">
                   <div id="topprodlist">
                   <div id="prodName"><p>Product Name:   <?php echo $row['productName']; ?></p></div>
                   <div id="prodCode"><p>Code:   <?php echo $row['code']; ?></p></div>
                   <div id="prodSize"><p>Size:   <?php echo $row['size']; ?></p></div>
                   <div id="prodDiameter"><p>Diameter:   <?php echo $row['diameter']; ?></p></div>
                   </div>
                   <div id="imageBox"><img src="prodimg/<?php echo $row['image']; ?>" width="100" height="100" alt="<?php echo $row['image']; ?>"></div>
                   <div id="prodDescription">
                   <div id="descript"><h5>Description:</h5></div>
                   <div id="prodTextBox"><p><?php echo $row['short']; ?></p>
                    <a href="info.php?in=<?php echo $row['id']; ?> ">More Details:</a>
                   </div>
                   </div>
                   <div id="clear"></div>
                   </div>
                   
			  <?php
			   }}
			   ?>
			   <?php 
                   if($pages >= 1){	
               for ($x=1; $x<=$pages; $x++){
	           echo "<a href=?id=$x> $x   </a>";
	           }
               }

?>	

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.