Re: Insert into ... select from using Cakephp
hi
Won't the query function return an array? wont this return an error?
please advise
thanks
chris
On Wednesday, April 10, 2013 10:07:53 PM UTC+8, dada123 wrote:
--Yes please chk this either it is working or not else just write thisforeach $outdaterec in $outdaterecs {$sql="INSERT INTO ... SET .....";$this->outdatePost->query($sql );}this will surely work...On Wed, Apr 10, 2013 at 7:21 PM, Yen Hua Chuah <chua...@gmail.com> wrote:
hi
do u mean i will do a select to retrieve all the necessary data from post
$outdaterecs=$this->Post->query("SELECT * FROM POST WHERE DATE_POSTED <= CURRENT_DATE()")
foreach $outdaterec in $outdaterecs
$this->outdatePost->create();
$this->outdatePost['outdatepost']['id'] = $outdaterec['Post']['id'];
$this->outdatePost->save()
endforeach
is this correct way of doing it? please advise as i am really new to cakephp
thanks
chrisOn Wed, Apr 10, 2013 at 9:43 PM, Soumavo Chatterjee <souma...@gmail.com> wrote:
why not withing a loop u can use it ....RegardsOn Wed, Apr 10, 2013 at 7:08 PM, Yen Hua Chuah <chua...@gmail.com> wrote:
hi
but the sql used will be inserting more than 10 records.
how can that function do?
please advise as i am very new to cakephp
thanks
chrisOn Wed, Apr 10, 2013 at 8:17 PM, Soumavo Chatterjee <souma...@gmail.com> wrote:
$this->data['Modelname']['fieldname']=value;
Check this it will workOn Wed, Apr 10, 2013 at 5:39 PM, Yen Hua Chuah <chua...@gmail.com> wrote:
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
chrisYou received this message because you are subscribed to the Google Groups "CakePHP" group.
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com .
To post to this group, send email to cake...@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 .
--
Regards
--
Soumavo ChattarajYou received this message because you are subscribed to a topic in the Google Groups "CakePHP" group.--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/d8SUYXDzXPk/ .unsubscribe?hl=en
To unsubscribe from this group and all its topics, send an email to cake-php+u...@googlegroups.com .
To post to this group, send email to cake...@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 .
--
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+u...@googlegroups.com .
To post to this group, send email to cake...@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 .
--
--
Soumavo Chattaraj
Sr. Application Programmer | Web Spiders
Mobile No: +91 9933561534 / +91 9330662099 /
EmailID: soumavo.chattaraj@webspiders.com/soumavo123@gmail.com
Web Spiders India Pvt. Ltd.
Matrix Tower,
8th and 9th Floor,
Plot No DN-24, Sector - V,
Salt Lake City,
Kolkata-700091,
India.
Phone: +91.33.4011.0900 / 53 | Fax: +91.33.4011.0939
URL: www.webspiders.com |
Twitter: twitter.com/Web_Spiders | Facebook: facebook.com/webspidersgroup | LinkedIn: linkedin.com/company/web-spiders
| The Leading Rich Mobile & Web Engineering Company--
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 a topic in the Google Groups "CakePHP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cake-php/d8SUYXDzXPk/ .unsubscribe?hl=en
To unsubscribe from this group and all its topics, send an email to cake-php+u...@googlegroups.com .
To post to this group, send email to cake...@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 .
--
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+u...@googlegroups.com .
To post to this group, send email to cake...@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 .
--
Regards
--
Soumavo Chattaraj
Sr. Application Programmer | Web Spiders
Mobile No: +91 9933561534 / +91 9330662099 /
EmailID: soumavo.chattaraj@webspiders.com/soumavo123@gmail.com
Web Spiders India Pvt. Ltd.
Matrix Tower,
8th and 9th Floor,
Plot No DN-24, Sector - V,
Salt Lake City,
Kolkata-700091,
India.
Phone: +91.33.4011.0900 / 53 | Fax: +91.33.4011.0939
URL: www.webspiders.com |
Twitter: twitter.com/Web_Spiders | Facebook: facebook.com/webspidersgroup | LinkedIn: linkedin.com/company/web-spiders
| The Leading Rich Mobile & Web Engineering Company
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.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home