I am trying to created created_at
column but I am always getting the following error.
error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' created_at DATETIME NOT NULL' at line 2
What am I doing wrong? I tested the query without created_at and it works the table I created.
I appreciate any help.
$results = $con->query ( "SHOW TABLES LIKE'" . $route ."'" ) or die ( mysqli_error () );
if (($results->num_rows) == 1) {
echo "Table exist";
} else {
$res = $con->query ( "CREATE TABLE " . $route . "(id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
latitude FLOAT(10,6) NOT NULL, longitude FLOAT(10,6) NOT NULL), created_at DATETIME NOT NULL" ) or die($con->error);
echo "table was craeted";
}