so I was using ezresults last night and found an issue where ezresults didn't setup the paging correctly for my query. after searching for the reason why I found out that the get_num_results() function didn't like subqueries at all
get_num_results() takes the query and changes everything between the word Select in your query and From. The problem is that if you have a subquery you could have more than 1 instance of the words Select in your overall query.
this may not be the appropriate way to fix the issue but here is how I fixed it.
on line 622 you have the below code:
$this->num_results = $db->get_var(preg_replace("/SELECT.*FROM/Ui","SELECT count(*) FROM",$query));
replace it with this code:
$this->num_results = $db->get_var(preg_replace("/1-SELECT.*FROM/Ui","SELECT count(*) FROM","1-".$query));
for this example I added a "1-" to the start of the query and to the start of the regular expression. by doing this it will only change the text for the start of the query.







3 Comments
Hey you know AdGuy always gets the last word! ;)