0

I am trying to add rows to my table using the code below. I keep getting an error. I doesn’t like the colons and if I take them out (although I need them in there) it then doesn’t like the 356’s. If I remove them it then doesn’t like something else.

I am using phpMyAdmin and thought I was using MySQL but the error messages mention MariaDB.

BTW, the book I am working through shows ‘ ‘ around the values to be inserted but I have found I can only insert values surrounded by “ “. What do I need to change to get this working in phpMyAdmin?

INSERT INTO colours (ID, ColourCode)
VALUES
(“356-30-127”, “356-30-127 : Red”),
(“356-30-128”, “356-30-128 : White”);
user3783243
  • 5,368
  • 5
  • 22
  • 41

1 Answers1

0

For data insertion you have to use " or ' in string type check below query it works

 create table colours (ID varchar(200),ColourCode varchar(200));
    INSERT INTO colours (ID, ColourCode) 
    VALUES ('356-30-127', '356-30-127 : Red'), 
    ('356-30-128', '356-30-128 : White');

http://sqlfiddle.com/#!9/2a14a8/1

Zaynul Abadin Tuhin
  • 31,407
  • 5
  • 33
  • 63
  • I am pasting the code in from Notepad. I have found that if I delete all the ' (tildes) in the phpMyAdmin SQL window and re-type them, the code works. Not sure why? – David Ball Aug 12 '18 at 07:21
  • @DavidBall i said in my answer that you typed wrong apostrophe for insert statement you have type ' or " for my sql and i show you that my answered please accept my answer if it helps – Zaynul Abadin Tuhin Aug 12 '18 at 07:24