I am trying to create a memory table in mysql through php but i keep getting an error:
Error creating database: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Order INT)ENGINE = INNODB' at line 1
Below is the code that i am using to try and create it:
$sql = "CREATE TABLE Persons(FirstName CHAR(30),LastName CHAR(30),Age INT, Order INT)ENGINE = MEMORY";
if (mysqli_query($con,$sql))
{
echo "Database my_db created successfully";
}
else
{
echo "Error creating database: " . mysqli_error($con);
}
Make sure you are escaping the predefined constants in MySQL like 'order'
See this post for more clarification:
Using backticks around field names