Did you add the Timestamp behavior to your Profiles table?

On Monday, May 19, 2014 3:17:39 PM UTC+2, Bayezid Alam wrote:
>
> Thanks a lot, i changed from username to user_id and its working perfectly
>
> but the second one is not working
>
> here is my table structure
>
> *CREATE TABLE IF NOT EXISTS `profiles` (*
> *  `id` int(11) NOT NULL AUTO_INCREMENT,*
> *  `name` varchar(40) NOT NULL,*
> *  `address` varchar(70) NOT NULL,*
> *  `email` varchar(30) NOT NULL,*
> *  `mobile` varchar(20) NOT NULL,*
> *  `user_id` int(11) NOT NULL,*
> *  `created` datetime DEFAULT NULL,*
> *  `modified` datetime NOT NULL,*
> *  PRIMARY KEY (`id`)*
> *) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=16 ;*
>
> *Below error is showing:*
>
> *Error: * Call to a member function format() on a non-object 
> *File* /var/www/html/test3/App/Template/Profiles/index.ctp 
> *Line: * 22 ( <td><?= h($profile->created->format(DATE_RFC850)) ?></td> )
>
> After removing Format(Date_RFC850)), the data is saving but created field 
> is entered as NULL.
>
> Thanks again
> Bayezid
>
>
> On Mon, May 19, 2014 at 10:03 AM, Dakota <[email protected]> wrote:
>
>> The line echo $this->Form->input('username', ['options' => $pUser]); 
>> should be 'user_id'. Also, if the variable is 'users' cakephp will 
>> automatically pick it up as the options for the field.
>>
>> Check that your created field allows null with default null.
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to