Wednesday, April 10, 2013

Insert into ... select from using Cakephp

hi
I would want to do a mass insert records into a table using sql

e.g. insert into outdatedpost select * from post where date_posted < current_date()

is there a way to do this in cakephp?

this function will be run every morning say 12.30 midnight

Hence i have to create a shell object for the outdatedpost.

Then in the shell object, i will call the Outdatedpost controller to perform this sql

$this->outdatedposts->query("insert into outdatedpost select * from post where date_posted < current_date()")

however, it seems that cakephp will give me an error on the query() function

please help!!!

thanks
chris

--
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: