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

  • Home
  • SEARCH
  • 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 171509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:00:01+00:00 2026-05-11T13:00:01+00:00

I’m using cakePHP and I want to add a First and Last name column

  • 0

I’m using cakePHP and I want to add a First and Last name column to the Users table, but when I pass through the field values firstname & lastname the columns are always left null, while the default fields are populate fine.

Is it possible to do this or do I need to have a second table to store these values?

Update code:

Registration form

        <?php     $session->flash('register');     echo $form->create('User', array('action' => 'register/'));     echo '<h3>Register</h3>';     echo $form->input('firstname', array('label'=>'First Name'));     echo $form->input('lastname', array('label'=>'Last Name'));     echo $form->input('username');     echo $form->input('email');     echo '<input class='submitimg' type='image' src='' . $basepath . 'img/btn_submit.gif' alt='Submit' />';     echo $form->end();     ?> 

Register action in user_controller.php

    function register() {     if (!empty($this->data)) {          $password = $this->str_makerand(8,10);         $this->data['User']['password'] = $this->Auth->password($password);          $this->User->create();          $result = $this->User->save($this->data);          if ($result) {             $this->Session->setFlash('Registration complete, an email will be sent with your password', 'default', array(), 'register');             $this->sendNewUserMail($this->data['User']['username'], $this->data['User']['email'], $password);         } else {                         $this->Session->setFlash('That username or email address is already taken, please try again', 'default', array(), 'register');         }                }     $this->redirect(array('controller' => 'properties', 'action' => 'index')); } 

MySQL users table:

CREATE TABLE users (   id int(11) NOT NULL AUTO_INCREMENT,   username char(50) DEFAULT NULL,   firstname varchar(100) NOT NULL,   lastname varchar(100) NOT NULL,   password char(50) DEFAULT NULL,   email varchar(100) NOT NULL,   created datetime NOT NULL,   PRIMARY KEY (id),   UNIQUE KEY email (email),   UNIQUE KEY username (username) ) 

Thanks for your help

  • 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. 2026-05-11T13:00:01+00:00Added an answer on May 11, 2026 at 1:00 pm

    You can definitely have additional fields on your users table. The Auth component will just authorize against your username and password fields in that table. In fact, if you read up on the Auth component’s attributes you’ll find that you can set which fields Cake will use as the user/pass fields.

    Sounds like your problem is a bug. Please post some code and database schema and I’ll take a look to help you further.

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

Sidebar

Ask A Question

Stats

  • Questions 282k
  • Answers 282k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Generally, properties should act like fields (little or no computation,… May 13, 2026 at 4:06 pm
  • Editorial Team
    Editorial Team added an answer If you think 11MB is "too much" memory... you'd better… May 13, 2026 at 4:06 pm
  • Editorial Team
    Editorial Team added an answer I think it would. I think it would just do… May 13, 2026 at 4:06 pm

Related Questions

I want use html5's new tag to play a wav file (currently only supported
In order to apply a triggered animation to all ToolTip s in my app,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I've got a string that has curly quotes in it. I'd like to replace

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.