Issue
I’m creating table in a database using this query
CREATE TABLE `Quote 1` (
ID INT(6) PRIMARY KEY,
`Task Title` VARCHAR(90) NOT NULL,
`Install Cost` INT NOT NULL,
`Schedule Position` VARCHAR(30) NOT NULL,
`Method` VARCHAR(90) NOT NULL,
`Task Time` INT NOT NULL,
`Van Parts` VARCHAR(90) NOT NULL,
`Order Parts` VARCHAR(90) NOT NULL,
`Parts Cost` INT NOT NULL,
`Equiptment` VARCHAR(90) NOT NULL,
`Description` VARCHAR(90) NOT NULL,
`Group` VARCHAR(90) NOT NULL
)
Then I’m trying to insert rows into the table using this
INSERT INTO `Quote 1`(`ID`, `Task Title`, `Install Cost`, `Schedule Position`, `Method`, `Task Time`, `Van Parts`, `Order Parts`, `Parts Cost`, `Equiptment`, `Description`, `Group`) VALUES (1,`TESTA`,2,`TESTB`,`TESTC`,3,`TESTD`,`TESTE`,4,`TESTF`,`TESTG`,`TESTH`)
Why this row is not being added? Pretty sure I’ve check all of the data types but I’m new to MySQLi and can’t find the problem.
Solution
Get rid of “ in column values and use single quote ' '
;
INSERT INTO
`Quote 1`
(
`ID`, `Task Title`, `Install Cost`,
`Schedule Position`, `Method`, `Task Time`,
`Van Parts`, `Order Parts`, `Parts Cost`,
`Equiptment`, `Description`, `Group`
)
VALUES
(
1,'TESTA',2,
'TESTB','TESTC',3,
'TESTD','TESTE',4,
'TESTF','TESTG','TESTH'
)
Answered By – Abhik Chakraborty
Answer Checked By – Robin (BugsFixing Admin)