$SQLCreateTableGames = "CREATE TABLE games (
		gameID SMALLINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
		whitePlayer MEDIUMINT NOT NULL,
		blackPlayer MEDIUMINT NOT NULL,
		gameMessage ENUM('',playerInvited', 'inviteDeclined', 'draw', 'playerResigned', 'checkMate') NULL,
		messageFrom ENUM('',black', 'white') NULL,
		dateCreated DATETIME NOT NULL,
		lastMove DATETIME NOT NULL
	);";

I get the following error message:
"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 'playerInvited', 'inviteDeclined', 'draw', 'playerResigned', 'checkMate') NULL, ' at line 5"

I want to know what change should be made,
but keep the way the table works all the same..
It is a chessprogram in PHP.

    After the empty strings inside the ENUMs there's no opening quote mark on 'playerInvited' nor on 'black' in the next ENUM.

    Sometimes typing just the SQL in a separate file that a (smart enough) editor knows is SQL can help see where to look:
    [upl-image-preview url=https://board.phpbuilder.com/assets/files/2019-08-01/1564689041-890443-screen-shot-2019-08-01-at-34943-pm.png]

    🙂

    Write a Reply...