Check your AppModel. The output you're seeing on the live server is normal for Cake when you have a function in your query. But there's a simple way to group the results together (as you're seeing on the local server) that involves afterFind(). See this link:
http://teknoid.wordpress.com/2008/09/29/dealing-with-calculated-fields-in-cakephps-find/ I'll bet you added that to your AppModel but forgot to upload that file to the server. On Mon, Jul 13, 2009 at 9:35 AM, keyurvaghani<[email protected]> wrote: > > Hello Friends, > > In cakephp, i am facing issues while execute query with custom > functions and including it in separate file using "bootstrap.php" > file as below: > > $db =& ConnectionManager::getDataSource('default'); > > $query="SELECT id, user_id, max( created ) AS `maxdate` > FROM orders GROUP BY user_id"; > $result = $db->fetchAll($query); > > > // Print Array Result > pr($result); // Here it will generate different array > structure on both local server and live server. > > It provides me following output on both servers as below: > > On Local Server: > > Array > ( > [0] => Array > ( > [orders] => Array > ( > [id] => 2 > [user_id] => 1 > [maxdate] => 2009-07-04 > ) > > ) > > [1] => Array > ( > [orders] => Array > ( > [id] => 1 > [user_id] => 2 > [maxdate] => 2009-02-12 > ) > > ) > > ) > > > On Live Server, Output of print Array result is: > > Array > ( > [0] => Array > ( > [orders] => Array > ( > [id] => 2 > [user_id] => 1 > ) > > [0] => Array > ( > [maxdate] => 2009-07-04 > ) > > ) > > [1] => Array > ( > [orders] => Array > ( > [id] => 1 > [user_id] => 2 > ) > > [0] => Array > ( > [maxdate] => 2009-05-20 > ) > > ) > > ) > > > Please check, both result array structure it is different and separate > "maxdate" column with index "0" on live server. > > I don't know why is it displayed different output of result array ? > > If anyone having solution of this problem then pls let me know.... > > Thanks in advance... > > Keyur. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
