Reputation: 13
I want to insert one value into a row. This row has multiple values. When I try to insert show error row-1 does not have default value.
$NoName = "Record_name";
$no = "20"; // I want to INSERT this no in row
$sql4 = "INSERT INTO record (date, month, year, $NoName) VALUES ('12-12-2016','12','2017', '$no')";
$result4 = mysqli_query($mysqli,$sql4) or die(mysqli_error($mysqli));
There is some more other rows like no 1, no 2,no 3 i just want to insert no 1 value in new row other values will be empty.
Upvotes: 1
Views: 89
Reputation: 27
You can add a default value to that column:
ALTER TABLE record ADD DEFAULT '0000-00-00' FOR date
This is from :
How to set a default value for an existing column
Note that you should use a valid default value.
Upvotes: 1