Note that there are some explanatory texts on larger screens.

plurals
  1. POcakephp find('all') not returning properly
    primarykey
    data
    text
    <p>So here is my latest issue: I run this query in my Cakephp controller:</p> <pre><code>$acctRenewLast2Entries = $this-&gt;AccountRenew-&gt;find ( 'all', array ( 'conditions' =&gt; array('Acc_Id' =&gt; $plan["Account"]["Acc_Id"]), 'order' =&gt; array('AccR_Id' =&gt; 'DESC') ) ); </code></pre> <p>I am expecting 4 records for this SQL statement. Instead, on running Debug in my controller, this is what I get for each row for above (see first record):</p> <pre><code>app/controllers/admins_controller.php (line 2584) 1 app/controllers/admins_controller.php (line 2584) Array ( [AccountRenew] =&gt; Array ( [AccR_Id] =&gt; 470 [AccR_Date] =&gt; 2012-06-23 01:21:11 [AccR_Hstart_Date] =&gt; 2012-06-23 01:21:11 [AccR_Hend_Date] =&gt; 2012-08-23 01:21:11 [AccR_End_Date] =&gt; 2013-08-23 01:21:11 [AccR_Status] =&gt; PAID [AccR_Reason] =&gt; RENEWAL [Inv_Id] =&gt; 467 [Inac_Id] =&gt; [Acc_Id] =&gt; 196 [AccT_Id] =&gt; 44 [Amount] =&gt; 16 [AccP_Id] =&gt; 0 ) ) app/controllers/admins_controller.php (line 2584) Array ( [AccountRenew] =&gt; Array ( [AccR_Id] =&gt; 465 [AccR_Date] =&gt; 2012-06-23 01:17:35 [AccR_Hstart_Date] =&gt; 2012-06-23 01:17:35 [AccR_Hend_Date] =&gt; 2012-07-23 01:17:35 [AccR_End_Date] =&gt; 2012-07-23 01:17:35 [AccR_Status] =&gt; PAID [AccR_Reason] =&gt; RENEWAL [Inv_Id] =&gt; 462 [Inac_Id] =&gt; [Acc_Id] =&gt; 196 [AccT_Id] =&gt; 41 [Amount] =&gt; 16 [AccP_Id] =&gt; 0 ) ) app/controllers/admins_controller.php (line 2584) Array ( [AccountRenew] =&gt; Array ( [AccR_Id] =&gt; 269 [AccR_Date] =&gt; 2012-06-06 10:15:56 [AccR_Hstart_Date] =&gt; 2012-06-06 17:15:56 [AccR_Hend_Date] =&gt; 2012-06-20 17:15:56 [AccR_End_Date] =&gt; 2012-06-20 10:15:56 [AccR_Status] =&gt; TRIAL [AccR_Reason] =&gt; [Inv_Id] =&gt; 0 [Inac_Id] =&gt; [Acc_Id] =&gt; 196 [AccT_Id] =&gt; 0 [Amount] =&gt; 0 [AccP_Id] =&gt; 0 ) ) </code></pre> <p>Now, when I run sql_dump, I get the following query that was run :</p> <pre><code>SELECT `AccountRenew`.`AccR_Id`, `AccountRenew`.`AccR_Date`, `AccountRenew`.`AccR_Hstart_Date`, `AccountRenew`.`AccR_Hend_Date`, `AccountRenew`.`AccR_End_Date`, `AccountRenew`.`AccR_Status`, `AccountRenew`.`AccR_Reason`, `AccountRenew`.`Inv_Id`, `AccountRenew`.`Inac_Id`, `AccountRenew`.`Acc_Id`, `AccountRenew`.`AccT_Id`, `AccountRenew`.`Amount`, `AccountRenew`.`AccP_Id` FROM `account_renews` AS `AccountRenew` WHERE `Acc_Id` = 196 ORDER BY `AccR_Id` DESC 4 4 </code></pre> <p>And when I run the above query in MySQL, I do get all my 4 records, including the first one which in the array appears as 1 (way up top of my write-up).</p> <p>I sincerely hope someone out there can help, because I spent the last 1.5 days without any luck as to why MySQL pulls up the complete set, but Cake only seems to retrieve the last 3, and replace the first record with an array of "1".</p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    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