Hello Tania,
Playing around with your CRUD tutorial to try to understand it, I ran into this error SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `test`.`users`.`age` at row 1 when creating a new record without age field.
Even though field can be null in MySQL, it should probably not be empty..?
Anyway, this is my workaround: in create.php, set age to "null" if empty
"firstname" => $_POST['firstname'],
"lastname" => $_POST['lastname'],
"email" => $_POST['email'],
"age" => (!strlen($_POST['age']) ? null : $_POST['age']),
"location" => $_POST['location']`
Liking your blog very much!
Hello Tania,
Playing around with your CRUD tutorial to try to understand it, I ran into this error
SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: '' for column `test`.`users`.`age` at row 1when creating a new record without age field.Even though field can be null in MySQL, it should probably not be empty..?
Anyway, this is my workaround: in create.php, set age to "null" if empty
Liking your blog very much!