I am doing an ajax to write records into the db. The table has id,fullname. The id is set to primary and auto increment. Now without the id (8 in the below statement) the record is not written.
Below is the insert statement
$sql =
"INSERT INTO user
VALUES ('8','".$_POST['name']."','test4','test5','test6')";
Is it possible to write without the id?
Place
NULLinstead of'8', that will tell MYSQL to do default auto increment:Other possibility is to rewrite your query to this from:
In this case you didnt specify id as a column to be inserted, so MySQL will again do the default auto increment