php - laraval can't retrieve the ID after inserting a row -
this code
$model = admin::create(input::only('username', 'password', 'mobilenumber', 'firstname', 'lastname')); echo $model->username; echo $model->id; exit; after executing code, can see new row in table. can see username printed.
the admin table has id field primary key , auto increment.
could help me please?
it's because using id instead of id, since dd($model)->toarray()) shows:
array(5) { ["username"]=> string(7) "asdfasdf" ["firstname"]=> string(5) "tonia" ["lastname"]=> string(8) "asdfasdf" ["mobilenumber"]=> string(11) "56456" ["id"]=> int(4) } so, create sure using proper case in every field name , seek utilize lower case field names in table well.
php mysql laravel laravel-4
No comments:
Post a Comment