Wednesday, March 19, 2014

using ->query to update

Hi guys,
I`m trying to do a update using a SQL query directly.
I`m having a strange behavior here, I use a similar query in another part of the code and it is updating normally.
When I use in the second part the update is updating the value as null.
I log the generated query and execute it directly into the DB and it works perfectly.
The query is
$query = $this->query("update stocks, (select  supply_id, action_id, qtd, qtd_total from actions_supplies where action_id= '".$id."') act_sup set stocks.qtd = (stocks.qtd + act_sup.qtd_total) where stocks.supply_id = act_sup.supply_id and flag_waiting = 'Y' and flag_original = 'N' and area_id = (select area_id from glebes where id = '".$glebe_id."')");
Does anyone had a similar behavior?
Any clues on how to fix this?
Thanks!
Augusto

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: