KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I found it very unprofessional to make a secondary query to check for more results in order to display a load more button. I'm using PDO, is there any way to get the total found rows without the limit filter but still filtering the results? Current Code: // Show Results $start = 0 $r=$db->prepare("SELECT * FROM locations WHERE area=:area LIMIT $start,10"); $r->execute($fields); // See if there is more results $r=$db->prepare("SELECT * FROM locations WHERE area=:area"); $r->execute($fields); $offset=$start+10; if($r->rowCount() > $offset){ echo "<div class='load'>Load More</div>"; }
Tags (comma-separated)
Save Edits
Cancel