CREATE TABLE IF NOT EXISTS `tblproduct` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`image` text NOT NULL,
`price` double(10,2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `product_code` (`code`)
)
INSERT INTO `tblproduct` (`id`, `name`, `code`, `image`, `price`)
VALUES
(1, '3D Camera', '3DcAM01', 'product-images/camera.jpg', '1500.00'),
(2, 'External Hard Drive', 'USB02', 'product-images/external-hard-drive.jpg', '800.00'),
(3, 'Wrist Watch', 'wristWear03', 'product-images/watch.jpg', '300.00');
-
1Please edit the question to include the actual error message.– Michael GreenJul 27, 2016 at 8:02
1 Answer
CREATE TABLE IF NOT EXISTS `tblproduct` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`image` text NOT NULL,
`price` double(10,2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `product_code` (`code`)
) <<<<------- put semi-colon here.
Your problem here is with the last line of your CREATE TABLE
- it should be );
and not just the bracket i.e. )
on its own! It's the sort of error that's very difficult to spot if you're trying to concentrate on the code - it's driven me mad a couple of times, I just couldn't see it! p.s. welcome to the forum!
-
1Glad to be of help. You should always include the full text of the error message in any questions. Take the tour, visit the help centre and check out the "help us to help you" blog. These forums are a great resource and you'll get all the more from them if you follow the guidelines :-)– VéraceJul 27, 2016 at 11:23