Zepo. Posted July 22, 2008 Share Posted July 22, 2008 Ok i have paging listing things from a table. I also have it not displaying certain things based on if there is anouther entree in anouther table. This causes paging problems because it will wnd up showing less and less instead having everything fall down. Example: loop: if(row exists in other table with same id) dont display So this causes the non display ones to count as an entree in the paging. Is there any way to make it check in the loop for the same id in anouther table before outputting? Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/ Share on other sites More sharing options...
Stephen Posted July 22, 2008 Share Posted July 22, 2008 What's the code your using? Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/#findComment-596048 Share on other sites More sharing options...
Zepo. Posted July 22, 2008 Author Share Posted July 22, 2008 This is the function with the loop. if(!function_exists('print_offers')) { function print_offers($userid, $notcompleted=1, $cat, $orderby, $order, $page) { $limit == 0; if($order == "DESC" or $order == "ASC"){ $order = $order; } else{ $order = "ASC"; } if($orderby == "cash" or $orderby == "dateadded" or $orderby == "votes" or $orderby == "rating" or $orderby == "completed"){ $orderby = $orderby; } else { $orderby = "name"; } if($cat == "CC"){ $query = @mysql_query("SELECT * FROM `mybb_offers` WHERE `cat` ='".$cat."' AND `MID` = 'no' ORDER BY `".$orderby."` ".$order." LIMIT $page,10"); } else { $query = @mysql_query("SELECT * FROM `mybb_offers` WHERE `cat` !='CC' AND `MID` = 'no' ORDER BY `".$orderby."` ".$order." LIMIT $page,10"); } while($row = @mysql_fetch_array($query, MYSQL_ASSOC)) { if($notcompleted == 1) { $check = @mysql_fetch_array(@mysql_query("SELECT id FROM `mybb_offerscompleted` WHERE `offerid`='".$row['id']."' AND `userid`='$userid'"), MYSQL_ASSOC); if(!$check['id']) { $limit++; $return = $return."<div class=\"updates_txt_header\"> <h2 class=\"updates_h2\">"; $stars = showstarts($row[id], "no", ""); if($cat == "1"){ $return = $return.stripslashes($row['cat']).": ".stripslashes($row['name'])." - <a href=\"out.php?id=".$row['id']."\" target=\"_blank\" onclick=\"location.reload(true);\"><span style=\"color:green\">Complete Offer</span></a> - <a href=\"#\" onclick=\"confirmation(".$row['id'].")\"><span style=\"color:red\">Ignore Offer</span></a></h2></div><div class=\"updates_txt\">"; }else{ $return = $return.stripslashes($row['name'])." - <a href=\"out.php?id=".$row['id']."\" target=\"_blank\" onclick=\"location.reload(true);\"><span style=\"color:green\">Complete Offer</span></a> - <a href=\"#\" onclick=\"confirmation(".$row['id'].")\"><span style=\"color:red\">Ignore Offer</span></a></h2></div><div class=\"updates_txt\">"; } $return = $return."<p><strong><span style=\"color:#000000\">Added on ".date("jS F Y", $row[dateadded])." | "; $times = @mysql_numrows(mysql_query("SELECT id FROM `mybb_offerscompleted` WHERE offerid='".$row['id']."' AND approved='1'")); if($times == "" || !$times) { $times = 0;} if($times != 1) { $return = $return."Completed $times Times | Offer Credit: <span style=\"color:green\">".CentsToDollars($row['cash'])."</span>.<br /></span></p></strong>"; } else { $return = $return."Completed 1 Time | Offer Credit: <span style=\"color:green\">".CentsToDollars($row['cash'])."</span><br /></p></span></strong>"; } $return = $return."<table><tr><td width=\"120\">"; if($row[imageurl]) { $return = $return.'<img src="'.$row['imageurl'].'" width="120" height="60" /><br />'; } $return = $return."$stars</td><td valign=\"top\"><p>".stripslashes($row['description'])."</p></td></tr></table>"; ?> <?php $return = $return."</div> <div class=\"updates_txt_footer\"> </div>"; } } else { $return = $return."<tr>"; $return = $return."<td>"; if($row['imageurl']) { $return = $return.'<img src="'.$row['imageurl'].'" /><br />'; } $return = $return."Added on <br />".date("jS F Y", $row['dateadded'])."."; $times = $row['completed']; if($times == "" || !$times) { $times = 0;} if($times != 1) { $return = $return."<br /><strong><u>Completed $times times.</u></strong>"; } else { $return = $return."<br /><strong><u>Completed 1 time.</u></strong>"; } $return = $return."</td>"; $return = $return."<td>"; $return = $return."<h2>".stripslashes($row['name'])."</h2><p>".stripslashes($row[description])."</p>"; $return = $return."<p>For this offer you will earn ".CentsToDollars($row['cash']).". <a href=\"out.php?id=".$row['id']."\" target=\"_blank\" onclick=\"location.reload(true);\">Complete Offer.</a></p>"; $return = $return."</td>"; $return = $return."</tr>"; } } $return = $return."</table>"; return $return; } } Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/#findComment-596050 Share on other sites More sharing options...
Zepo. Posted July 22, 2008 Author Share Posted July 22, 2008 Is this possible? Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/#findComment-596099 Share on other sites More sharing options...
rameshfaj Posted July 22, 2008 Share Posted July 22, 2008 In ur queries how can u say that there are only 10 entries(as u have used in limit).Also if u dont want to count the entries that are not to be displayed then why not to write the query in similar manner? Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/#findComment-596196 Share on other sites More sharing options...
Zepo. Posted July 23, 2008 Author Share Posted July 23, 2008 There are 10 entrees per page, i want it not to incluse the completed ones (ones entered into offerscompleted) on the paging, or loop. Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/#findComment-597048 Share on other sites More sharing options...
Zepo. Posted July 24, 2008 Author Share Posted July 24, 2008 *Bump* This is important, please anyone. Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/#findComment-599040 Share on other sites More sharing options...
Zepo. Posted July 25, 2008 Author Share Posted July 25, 2008 Anyone? Link to comment https://forums.phpfreaks.com/topic/115930-paging-question/#findComment-599127 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.