Welcome Guest, Not a member yet? Register   Sign In
Problem with select. num_rows = +10000
#1

[eluser]Unknown[/eluser]
I have a select in mysql table that return +10000 rows.
but when I try:

Code:
foreach($rs->result() as $row){
...
}

I get blank page.

but if I use "limit 5000" or "limit 2000,5000" I get a normal page.

How do I solve this problem?

I need to get the +10000 rows.
#2

[eluser]jrtashjian[/eluser]
A couple things to check. Make sure the script isn't timing out and that you aren't running out of memory. Check these settings in php.ini: memory_limit and max_execution_time. Raise the limits and try again. Also, make sure errors are turned on in php.ini with: display_errors and error_reporting.
#3

[eluser]Fireclave[/eluser]
nobody needs a webpage with 10000rows. take a few rows and use the pagination library !
#4

[eluser]Christophe28[/eluser]
I'm actually curious why you need + 10000 rows from your db in one time? To backup ...? Because there are better ways to do this.
#5

[eluser]tonanbarbarian[/eluser]
1. have you run the query in phpMyAdmin or similar and seen how long it taks to generate your results?
It is possible that your query takes to long to execute before it even is sent back to PHP.
You may be able to rewrite your query to improve performance, or you may need to add some indexes, or modify your query to use your indexes more effectively to get the database to return your results quicker

2. I understand in some instances that you may need to process 10000+ rows but can you do those 10,000+ rows in batches of 500?
is it possible to loop through and retrieve 500 records at a time keeping count until you have processed 10,000, or however many you need.




Theme © iAndrew 2016 - Forum software by © MyBB