Answer the question
In order to leave comments, you need to log in
How to setup phpMyAdmin autoincrement in Open Server?
Hello! I work with open server and mysql database. I made a base and turned on autoincrement for the id column.
I wanted to write data in this form: '', 'login', 'pass' but the record was not added, the reason is in id when I leave it empty. When I wrote 1 instead of empty quotes, the entry was added. Hosting works.
Here is the PHP code:
mysqli_query($db, "INSERT INTO `users` VALUES('', '$login', '$pass')");
Answer the question
In order to leave comments, you need to log in
Not in Open Server, but in your own code
1. Instead of '', you must write null
2. Never shove variables directly into the request, but pass them separately.
3. In order not to poke your finger into the sky in search of an error, you need to configure error messages in mysqli
$stmt = $db->prepare("INSERT INTO `users` VALUES(null, ?,?)");
$stmt->bid_param("ss", $login, $pass);
$stmt->execute();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question