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
chris

On Wed, Apr 10, 2013 at 9:43 PM, Soumavo Chatterjee <[email protected]>wrote:

> why not withing a loop u can use it ....
>
>
> On Wed, Apr 10, 2013 at 7:08 PM, Yen Hua Chuah <[email protected]> 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
>> chris
>>
>> On Wed, Apr 10, 2013 at 8:17 PM, Soumavo Chatterjee <[email protected]
>> > wrote:
>>
>>> $this->data['Modelname']['fieldname']=value;
>>>
>>> Check this it will work
>>>
>>>
>>> On Wed, Apr 10, 2013 at 5:39 PM, Yen Hua Chuah <[email protected]>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
>>>> 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 [email protected].
>>>>
>>>> To post to this group, send email to [email protected].
>>>> 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
>>>
>>>
>>> *
>>>
>>> --
>>> 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
>>> [email protected].
>>>
>>> To post to this group, send email to [email protected].
>>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> 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: [email protected]/[email protected]
>
> 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
> [email protected].
> To post to this group, send email to [email protected].
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to