Support » Fixing WordPress » Troubleshoot $wpdb queries

  • 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;

    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?


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Troubleshoot $wpdb queries’ is closed to new replies.