0

Hello i am having an issue when trying to create a table inside of my database webhostc_MyRadContactForm

When i try to execute the statement below in phpMyAdmin i get this error

CREATE TABLE Contacts (
-> ContactID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> ContactName VARCHAR(100),
-> ContactEmail VARCHAR(100),
-> ContactLeastFavoriteColor VARCHAR(10)
-> ContactDateCreated DATETIME
-> );

#1064 - 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 '-> ContactID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, -> ContactName VARCHA' at line 2

Also phpMyAdmin flags these lines:

enter image description here

My server is running: 10.0.22-MariaDB

2 Answers 2

1

You are missing a comma just after ContactLeastFavoriteColor VARCHAR(10) and those arrows, ->, are not supposed to be there. The following is the correct syntax for creating your table:

CREATE TABLE Contacts (
  ContactID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  ContactName VARCHAR(100),
  ContactEmail VARCHAR(100),
  ContactLeastFavoriteColor VARCHAR(10),
  ContactDateCreated DATETIME
);

Good luck!!

Sign up to request clarification or add additional context in comments.

3 Comments

The error message complains about the -> symbols, not the missing comma.
@Barmar I second that, that's why I didn't add them to my answer.
I noticed that, but you could have mentioned that this was the problem.
1

There are two problems:

  1. Those -> symbols aren't part of SQL syntax. They're the prompts that the MySQL monitor prints when you enter a multi-line query. You can't copy them into PhpMyAdmin.

  2. You're missing a comma at the end of the ContactLeastFavoriteColor line.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.