• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Large DB recordset - returns num_rows, but no row data


I have a DB query that returns over 50000 results from the DB.

If we assume that my function and query looks like

function get_all_rec()


$qUsers = $this->db->get();

return $qUsers

and then in another method in the class, I have:

$qUsers = $this->get_all_rec();

I can then output:

echo 'num_rows(): '.$qUsers->num_rows().'<br />';

but when I try and get:

echo 'first row, user id: '.$qUsers->row(0)->user_id.'<br />';

codeigniter/php doesn't return anything. The whole script terminates and I don't know why.

Has anyone else had this issue with CI?



I should also add that it works on my local WAMP environment, but when put into a CentOS, Apache, Mysql, PHP env, it fails

check the log file.

You will need to have your results as an array and then output userid | first row in a table.That will work.You will find the topic about generating results very useful,take a look.


Unfortunately, this is now on a live site, so I can't check the CI logs (if that's what you meant), as it slows the site down far too much.

I've tried changing the return type to result_array(), but still it won't return the user data.

I can't really help you with this but I am kinda curious why you want to output 50000 rows of data!?


I'm not wanting to output the data....instead I want to run some code against each other. Think of it as a cron against all users.

The only other thing I can think of is to limit it to 1000 each time or something.....

I think running 50 querys that return 1000 rows each might be faster than having one huge query with 50000 rows. But you might have to benchmark to find out.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.