I'm trying to make some tables in my database using this.
but I get this error:
Error creating table: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UNSIGNED AUTO_INCREMENT, ip VARCHAR(65) NOT NULL, attempts INT(11) ' at line 2
on this:
$dbprefix = 'duh_';
$prefixloginAttempts = $dbprefix . 'loginAttempts';
$table = array();
$table[] = "CREATE TABLE IF NOT EXISTS $prefixloginAttempts (
id INT(11) NOT NULL UNSIGNED AUTO_INCREMENT,
ip VARCHAR(65) NOT NULL,
attempts INT(11) NOT NULL,
lastLogin DATETIME NOT NULL,
username VARCHAR(65) NOT NULL,
mod_timestamp TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY ('id'),
UNIQUE KEY 'id_UNIQUE' ('id')
) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
foreach ($table as $sql) {
$query = $conn->query($sql);
}
Someone that can see where the fail is? I cant..