[eluser]tokyotech[/eluser]
In my MySQL columns, NULL means the user never filled out the form field. So I have to use the ternary operator to correctly insert rows:
Code:
$this->accountModel->createUser(
array(
'email' => $this->input->post('email'),
'password' => $this->input->post('password'),
'name' => $this->input->post('name') ? $this->input->post('name') : NULL,
'gender' => $this->input->post('gender'),
'created' => time()
)
);
1) Is there a way to make post() return NULL rather than FALSE if the value is ""?
2) After I get question #1 working, how do I dump the whole post() array into my model's method? I must use post() rather than $_POST because $_POST will assign "" to form elements that were untouched. Ideally, this code could be cut down to:
Code:
// this doesn't work:
$this->accountModel->createUser($this->input->post())