id.'" ORDER BY id DESC'; $review_result_image_copy = $review_result = mysql_query($review_q) or die(mysql_error()); $total_reviews=mysql_num_rows($review_result); //$review_q='SELECT * FROM ind_writereview a LEFT JOIN ind_ratebusiness b ON a.user_email= b. user_email WHERE a.companyId='.$row->id.' AND b. companyId='.$row->id.' GROUP BY a.id'; //start paging here $total_pages=$total_reviews; $targetpage = "detail_reviews.php"; $limit = 10; if(isset($_GET['page'])){ $page = $_GET['page']; } else { $page=''; }; if($page){ $start = ($page - 1) * $limit; }else{ $start = 0; } if(isset($_REQUEST['sort'])){ $sort=$_REQUEST['sort']; } else { $sort=""; } if(isset($_REQUEST['type'])){ $type=$_REQUEST['type']; }else{ $type=""; } $query_string='id='.$id.'&sort='.$sort.'&type='.$type; $orderBy = "ORDER BY id DESC"; if($sort=='ASC' and $type=='d') { $orderBy = "ORDER BY writeReviewdate ASC"; } elseif($sort=='ASC' and $type=='r') { $orderBy = "ORDER BY rating ASC"; } elseif($sort=='DESC' and $type=='d'){ $orderBy = "ORDER BY writeReviewdate DESC"; } elseif($sort=='DESC' and $type=='r') { $orderBy = "ORDER BY rating DESC"; } //$review_q="SELECT * FROM ind_writereview WHERE companyId='".$row->id."' '".$orderBy." ' LIMIT '".$start." ','".$limit; $review_q = "SELECT * FROM ind_writereview WHERE companyId=".$id." ".$orderBy. " LIMIT ".$start.",".$limit.""; //echo $review_q; exit; $review_result_copy = $review_result = mysql_query($review_q) or die(mysql_error()); /* Setup page vars for display. */ if($page == 0) { $page = 1; } $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $lpm1 = $lastpage - 1; $pagination = ""; if($lastpage > 1) { $pagination .= "