Friday, 15 August 2014

php - Laravel 1048 Column cannot be NULL on storing data -



php - Laravel 1048 Column cannot be NULL on storing data -

when i'm trying save new contact i'm getting 1048 column 'username' cannot null error. it's pretty obvious cause of error empty value of username, i'd create work without setting column null or checking if username post info empty , setting it's value ''.

i've seen numerous of examples, column not set null and/or info not set '' before saving database.

or maybe i'm wrong , missed ?

i hope comment on that..

$contact = new contact; $contact->name = input::get('name'); $contact->username = input::get('username'); $nerd->save();

set default non-null values input variable(s).

$contact = new contact; $contact->name = input::get('name'); $contact->username = input::get('username', false); $nerd->save();

php mysql laravel

No comments:

Post a Comment