Try:

if (!empty($this->data))
{
    $this->cleanUpFields();

    // Modifications on the database
    $LoggedUsername = $this->Session->read('User.handle');
    $this->data['Feature']['username_created']  = $LoggedUsername;

    if ($this->Feature->save($this->data))
    {
        $this->Session->setFlash('Your new article has been saved.');
        $this->redirect(array('action'=>'index'), null, true);
    }

}

$this->data contains HTTP POST variables.
You can not use saveField without seting active record like:
$this->Featured->id = $_some_id;
$this->saveField(...);


On Jan 14, 6:03 am, "Louie Miranda" <[EMAIL PROTECTED]> wrote:
> I tried this..
>
> if (!empty($this->data))
> {
>     $this->cleanUpFields();
>
>     // Modifications on the database
>     $LoggedUsername = $this->Session->read('User.handle');
>     *$this->Feature->saveField('username_created', $LoggedUsername);*
>
>     if ($this->Feature->save($this->data))
>     {
>         $this->Session->setFlash('Your new article has been saved.');
>         $this->redirect(array('action'=>'index'), null, true);
>     }
>
> }
>
> *Debug:*
>                   36033 Query       INSERT INTO `features_posts`
> (`username_created`) VALUES ('user1')
>                   36033 Query       SELECT LAST_INSERT_ID() AS insertID
>                   36033 Query       SELECT COUNT(*) AS `count` FROM
> `features_posts` AS `Feature`   WHERE `Feature`.`id`  =  21
> 080114 13:00:12   36033 Query       UPDATE `features_posts` SET `title` =
> 'sdffs',`categ_id` = 1,`publish_status` = '0',`paragraph` = 'sdffsfs'  WHERE
> `id` IN (21)
>
> It was posted with username_created, but i am not sure if this is a proper
> way on Cake?
>
> Please help!
>
> Thanks
> Louie
>
> On Jan 14, 2008 12:54 PM, Louie Miranda <[EMAIL PROTECTED]> wrote:
>
>
>
> > HELP! I am trying to save on my username_created field. But, could not.
> > username_created is not on my view.
>
> > I tried this on my controller.
>
> > if (!empty($this->data))
> > {
> >     $this->cleanUpFields();
>
> >     // Modifications on the database
> >     $LoggedUsername = $this->Session->read('User.handle');
> >     $this->Feature->username_created = $LoggedUsername;
>
> >     if ($this->Feature->save($this->data))
> >     {
> >         $this->Session->setFlash('Your new article has been saved.');
> >         $this->redirect(array('action'=>'index'), null, true);
> >     }
> > }
>
> > But, this syntax: $this->Feature->username_created = $LoggedUsername;
> > before save(), is not working.
>
> > How, could i add a username_field when saving on a controller?
>
> > --
> > Louie Miranda ([EMAIL PROTECTED])
> >http://www.axishift.com
>
> > Security Is A Series Of Well-Defined Steps
> > chmod -R 0 / ; and smile :)
>
> --
> Louie Miranda ([EMAIL PROTECTED])http://www.axishift.com
>
> Security Is A Series Of Well-Defined Steps
> chmod -R 0 / ; and smile :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to