Inserting Records with Missing Columns via SQL Query in PHP
What happens if you do not specify a value for a column? For example, let's specify only the name and age:
<?php
$query = "INSERT INTO users (name, age) VALUES ('user', 30)";
mysqli_query($link, $query) or die(mysqli_error($link));
?>
In this case, the unspecified columns will take their default value. If such a value is not specified in PhpMyAdmin, it will lead to an error and such a query will fail to execute.
Add a new user 'xxxx'
,
without specifying their age and salary.