Hi I am getting a mysql syntax error when I try to insert into a mysql table.
I think the problem I have is that my table structure is not set up properly and have had litle experience in what i should use and when to use null etc.
When I list the field names in my sql insert query i get syntax error on line 1 but if I just list the values it updates.
The table i am inserting into is as follows:
CREATE TABLE `walks` (
`walk_id` int(11) NOT NULL AUTO_INCREMENT,
`title` varchar(256) NOT NULL,
`heading` varchar(256) NOT NULL,
`subheading` varchar(256) NOT NULL,
`description` text NOT NULL,
`region` varchar(256) NOT NULL,
`walk-option1` text NOT NULL,
`walk-price1` text NOT NULL,
`walk-supplement1` text NOT NULL,
`walk-option2` text NOT NULL,
`walk-price2` text NOT NULL,
`walk-supplement2` text NOT NULL,
`walk-option3` text NOT NULL,
`walk-price3` text NOT NULL,
`walk-supplement3` text NOT NULL,
`rest1` text CHARACTER SET latin2 NOT NULL,
`rest1price` text NOT NULL,
`rest2` text NOT NULL,
`rest2price` text NOT NULL,
`img1` varchar(256) NOT NULL,
`img2` varchar(256) NOT NULL,
`img3` varchar(256) NOT NULL,
`map` varchar(256) NOT NULL,
PRIMARY KEY (`walk_id`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
the error I get is :
INSERT INTO walks (NULL, title, heading, subheading, description, region, walk-option1, walk-price1, walk-supplement1, walk-option2, walk-price2, walk-supplement2, walk-option3, walk-price3, walk-supplement3, rest1, restprice1, rest2, restprice2, img1, img2, img3, map) VALUES ('n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', 'n', '', '', '', '', '', '', '', '', '', 'No Image', '', '', '' )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 'NULL, title, heading, subheading, description, region, walk-option1, walk-price1' at line 1






Bookmarks