Quantcast
Channel: Topic Tag: MySQL | WordPress.org
Viewing all articles
Browse latest Browse all 5530

FPG on "Troubleshoot $wpdb queries"

$
0
0

Hello All,

I semi inherited a report generator that pulls a bunch of information from various tables into the database with one big query and I'm running into issues when the query returns large data sets.

I have a statement like so:

$ui = $wpdb->get_results($q);

When I count($ui), I can see that there are 5261 records in the dataset which is correct. When I try to print out all these records with a foreach loop...

foreach($ui as $usr){
  echo $usr->id;
  set_time_limit(0);
}

My foreach loop suddenly stops at record 3515 of the query and kills the rest of the script. I have the set_time_limit to tell PHP to keep going.

I'm no MySQL wizard, but it looks like the database is closing the connection prematurely. I'm not getting any PHP errors, just a blank white screen.

Any ideas?

Thanks!


Viewing all articles
Browse latest Browse all 5530

Trending Articles