Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3283984
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:06:13+00:00 2026-05-17T20:06:13+00:00

I have a CakePHP application that allows a user to register and post projects.

  • 0

I have a CakePHP application that allows a user to register and post projects. At some point whilst I have been tinkering with it I have managed to change the way the current date is captured when the user record is created 🙁 when a new user account is created the date is defaulted to

Jan 19th 1970, 01:00

Here is my register action in the users controller:

 function register()
{
    if ( !empty( $this->data ) ){
       if ( $this->data['User']['password'] 
                == $this->Auth->password( $this->data['User']['password_confirm'])) {

                    $this->User->create();
                    if ( $this->User->save($this->data) ){
                        $this->redirect(array('action' => 'index')); 
                    }

        } else {
            $this->Session->setFlash('password mismatch');
  }
 }
}

Register view:

<?php
$currentdatetime = time();
echo $form->create( 'User', array('action' => 'register' ) );
echo $form->input('username', array( 'label' => 'Username' ) );
echo $form->input('fname', array( 'label' => 'First name' ) );
echo $form->input('lname', array( 'label' => 'Last name' ) );
echo $form->input('emailaddress', array( 'label' => 'Email Address') );
echo $form->input('website', array( 'label' => 'Website') );
echo $form->hidden( 'created', array( 'value' => $currentdatetime ) );
echo $form->input('password', array( 'label' => 'Password', 'type' => 'password') );
echo $form->input('password_confirm', array( 'label' => 'Retype Password', 'type' => 'password' ) );
 echo $form->submit();
echo $form->end();
?>

I have a users table with a created DATETIME column. Not NULL, default ‘0000-00-00’

Can someone help me out here? I’m thinking I’ve maybe just deleted a line of cod or something

Thanks,

Jonesy

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:06:13+00:00Added an answer on May 17, 2026 at 8:06 pm

    The default value for the created column has to be NULL according to the cookbook:

    These fields need to be datetime fields with the default value set to NULL to be recognized by CakePHP.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a backend data management console written with CakePHP that allows a user
I have a web application that has been done using Cakephp with MySql as
I have been busy integrating Wordpress to one of a CakePHP application.Last Monday I
I have built an application in CakePHP that lists businesses. There are about 2000
let's say i have: http://some-domain/application/controller/action/parameter This is somehow working in cakePHP. Now I want
I have an existing web application that I am converting to use CakePHP. The
We have an old (written in CakePHP 1.1!) application that has started groaning under
Background I have a CakePHP application that lives in /m/ . I want to
I have a CakePHP 1.3 application that has a login system, which works well.
In my CakePHP application layout I have a section for latest posts that needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.