MySQLi CREATE Table query not working
mysql, mysqli, php
Solution
You should have seen that error with that statement:
Incorrect table definition; there can be only one auto column and it must be defined as a key:
`auto_increment` column must have an `UNIQUE`index on them, or more generally being the `PRIMARY KEY`:
$sql = "CREATE TABLE comments
(
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
PosterName VARCHAR(32),
Title VARCHAR(32),
Content VARCHAR(500)
)";
Problem
``` $sql = "CREATE TABLE comments ( ID INT NOT NULL AUTO_INCREMENT, PosterName VARCHAR(32), Title VARCHAR(32), Content VARCHAR(500) )"; $con->query($sql); ``` No errors, connection to database is successful. Does anyone know why it doesnt work?