hi, i'm newby in using cakePHP. i have 2 tables: customerbills and customerpurchases.
what i want to do is to make a sum query in customerpurchases and update it in customerbills. customerpurchases fields: -id -customerbill_id -product -amount customerbills fields: -id -customer_id -amountbill Here's what i did in my customerpurchasesController: $billid = 1; $total = $this->Customerpurchase->query("SELECT SUM(customerpurchases.amount) AS total From customerpurchases Group by customerbill_id = $billid"); now i try this for updating: $this->Customerpurchase->query("UPDATE bills SET amountbill = $total Where id = $billid"); but i it doesn't work. I tried to display the variable $total in session flash to check what's inside the variable and it displays "arrays" .. pls. help me. Thanks.. -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php