Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you could do:</p> <pre><code>$list = $this-&gt;AnyModel-&gt;query("SELECT * FROM big_table"); </code></pre> <p>but i dont think that will solve your problem, because if you have, for exemple, 10millon rows.. php wont be able to manage an array of 10millon values... </p> <p>but you might want to read this two links to change the <a href="http://davidwalsh.name/increase-php-script-execution-time-limit-ini_set" rel="nofollow noreferrer">execution time</a> and the <a href="http://davidwalsh.name/increase-php-memory-limit-ini_set" rel="nofollow noreferrer">memory limit</a>.. you could also change them on your php.ini</p> <p>Good Luck!</p> <p><strong>EDITED</strong> hmm thanks to your question i've learned something :P First of all, we all agree that you're receiving that error because Cake executes the query and tries to store the results in one array but php doesn't support an array that big so it runs out of memory and crashes.. I have never used the classic mysql_query() (i prefer PDO) but after reading the docs, it seems that mysql_query stores the results inside a <a href="http://fr2.php.net/manual/en/language.types.resource.php" rel="nofollow noreferrer">resource</a> therefore, it's not loading the results on memory, and that allows you to loop the results (like looping though a big file). So now i see the difference... and your question is actually, this one:</p> <p><a href="https://stackoverflow.com/questions/538921/can-i-stop-cakephp-fetching-all-rows-for-a-query">Can I stop CakePHP fetching all rows for a query?</a></p> <p>=) i understand your frustration with cake, sometimes i also get frustrated with it (could you believe there's no simple way to execute a query with a HAVING clause?? u_U)</p> <p>Cheers!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload