Ezresults & subqueries ver 2.0

Rate this:
By bkramer (Contact - View My Woyano)
Published Thu 13 Sep 2007, 280 Views, 2 Comments

So Back in march I made a modification to ezresults to fix a bug I found with the get_num_results function. The but was that when you used subqueries it would error out trying to figure out the number of results found and it wouldn't generate the navigation links. You can read it here:

 http://www.woyano.com/view/1362/Ezresults--subqueries

 When I wrote the article I knew that my way of fixing the problem wasn't the correct way to resolve the issue and was hoping that maybe someone would post with a better method. So 6 months later I ran into a problem once again building the navigation links and found out that the modifications I made were only useful when you did the subquery after the where portion of the query, not if the subquery was inbetween the initial "Select" and "From" so here is the only way I found out how to reslove the issue.

 

on line 622 you should see the following:

$this->num_results =  $db->get_var(preg_replace("/SELECT.*FROM/Ui","SELECT count(*) FROM",$query));

or(if you made the changes from my earlier post)

 $this->num_results =  $db->get_var(preg_replace("/1-SELECT.*FROM/Ui","SELECT count(*) FROM","1-".$query)); 

comment out the line above and replace it with:

$db->query($query);

$this->num_results = $db->num_rows;

 

 if there is a better way to do this please feel free to let me know.

 



This Item
Category: Knowledge, Snippets, Technology
Tags: ezsql,ezresults,
Contributor
bkramer
Share it
Link to this item:
Bookmark this item: RSS Feed

People who liked this item

    2 Comments

  1.  
    JV ~ 12 months ago
    0 votes thumbs up thumbs down
    Thanks for posting this. Sorry for not folding it into the build just been so busy!
    [ reply ]
    1.  
      bkramer ~ 12 months ago
      0 votes thumbs up thumbs down
      not a problem. this method should work all the time.
      [ reply ]
    2.  
      22 votes thumbs up thumbs down
      This is my two cents...

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

    Please Login to Add Your Comment   ..or..  

    Replying to comment by