raptor30506090 Posted February 17, 2012 Share Posted February 17, 2012 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>"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/257212-pagination/ Share on other sites More sharing options...
El Chupacodra Posted February 17, 2012 Share Posted February 17, 2012 Usually if you have results on page 1 and not the next page it's because some variable didn't carry over. What do you get if you echo all your variables? Also, echo the query so you can see what it looks like on page 2. Quote Link to comment https://forums.phpfreaks.com/topic/257212-pagination/#findComment-1318461 Share on other sites More sharing options...
raptor30506090 Posted February 17, 2012 Author Share Posted February 17, 2012 ok still looking see if i can find it when i hit main menu buttons thats fine it only the Pagination part going wrong think mite have somthing todo with id Quote Link to comment https://forums.phpfreaks.com/topic/257212-pagination/#findComment-1318463 Share on other sites More sharing options...
El Chupacodra Posted February 17, 2012 Share Posted February 17, 2012 Does it work if you change to echo "<a href='?id='".$x."> ".$x." </a>"; Quote Link to comment https://forums.phpfreaks.com/topic/257212-pagination/#findComment-1318475 Share on other sites More sharing options...
raptor30506090 Posted February 19, 2012 Author Share Posted February 19, 2012 sorry no that dont work realy suck with this one Quote Link to comment https://forums.phpfreaks.com/topic/257212-pagination/#findComment-1318899 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.