Error with MySQL Syntax

Hello! I am working on a PHP project that works with databases. I recently got this error:

Table Creation Error: CREATE TABLE IF NOT EXISTS details ( title VARCHAR(255) NOT NULL, logo VARCHAR(255) NOT NULL, description VARCHAR(255) NOT NULL, ) ENGINE=INNODB;
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 ') ENGINE=INNODB' at line 5

This is my SQL command in PHP:

$sql = "CREATE TABLE IF NOT EXISTS details (
  title VARCHAR(255) NOT NULL,
  logo VARCHAR(255) NOT NULL,
  description VARCHAR(255) NOT NULL,
)  ENGINE=INNODB;";

What did I do wrong here? How can I fix the statement?

your problem is the dangling comma

it would be more obvious if you had used the leading comma convention for formatting your SQL code

CREATE TABLE IF NOT EXISTS details 
( title VARCHAR(255) NOT NULL
, logo VARCHAR(255) NOT NULL
, description VARCHAR(255) NOT NULL
,
)  ENGINE=INNODB
2 Likes

I got another error with that, I am going to try to create a SQL file with the sql code.
Just one more question, how can I log into mysql without user imput? (ie. I do not have to type anything in)

Puedo Code:
mysql -u username -p password

not sure i understand the question

you don’t have to use the command line, though

i suggest a front-end tool like HeidiSQL