jquery - Show Selected Category => Product limit in each Page [ 1,2,3,... ] using PHP and MySQL -
when click on next link or page after page 1, following error:
notice: undefined index: id in c:\wamp\www\rd\view\client\fg-shop.php on line 116
warning: mysql_num_rows() expects parameter 1 resource, boolean given in c:\wamp\www\rd\view\client\fg-shop.php on line 121
warning: mysql_num_rows() expects parameter 1 resource, boolean given in c:\wamp\www\rd\view\client\fg-shop.php on line 135
no products displaying in page , [ 1,2,3,...] link.
<?php include_once("../../config.php"); include_once __base_path."/model/categorymodel.php"; include_once __base_path."/model/categoryimagemodel.php"; $catid = $_request['id']; if($fkcategoryp=="") $pageresult = $categoryimagemodel->categoryimageselect('status=1 , fkcategory='.$catid,'sortorder','asc',''); else $pageresult = $categoryimagemodel-categoryimageselectparent($fkcategory,'sortorder','asc',''); $total = mysql_num_rows($pageresult); $adjacents = 3; $targetpage = (isset($_request['fkcategory']))? "fg-shop.php?fkcategory=".$catid."&" : "fg-shop.php?fkcategoryp=".$fkcategoryp."&"; //your file name (the name of file) $limit = 3; $i = 0; $per_page = 3; $pages = ceil($total/$per_page); $total_pages = $total; $page = (isset($_get['page'])) ? (int)($_get['page']) : 1 ; $start = ($page - 1) * $per_page; if($fkcategoryp=="") $result = $categoryimagemodel->categoryimageselect('status=1 , fkcategory='.$catid,'sortorder','asc',''.$start.','.$per_page.''); $count = mysql_num_rows($result); if($count!=0) { $counter = 0; while($row = mysql_fetch_array($result)) { $id = $row['id']; $catimagename = $row['imagename']; $imagetitle = $row['imagetitle']; $price = $row['price']; ?> <div class="cell-4 fx shop-item" data-animate="fadeinup"> <div class="item-box"> <div class="item-img"> <a href="fg-product-details.php?id=<?php echo $id; ?>"><img src="../../imguploads/categoryimage/<?php echo $catid; ?>/original/<?php echo $catimagename; ?>" alt="1" title="<?php echo $imagetitle; ?>"/></a> </div> <div class="item-details"> <p style="text-align:center;"><?php echo $imagetitle; ?></p> <div class="rights"> <div class="item-price"><i class="fa fa-rupee"></i> <?php echo $price; ?></div> </div> </div> </div> </div> <?php } } ?> <?php include('pagination.php'); ?> </div> </div> </div> </div> <div class="clearfix"></div> <div class="pager skew-25"> <ul> <?php echo $pagination; ?> </ul> </div> </div>
i used pagination next page function. when click category need display limited product in each page.
change 'id' 'id' in code as:
<a href="radnus-product-details.php?id=<?php echo $id; ?>"><img src="../../imguploads/categoryimage/<?php echo $catid; ?>/original/<?php echo $catimagename; ?>" alt="1" title="<?php echo $imagetitle; ?>"/></a>
it's minor mistake. helful you.
Comments
Post a Comment