CyberShot Posted November 26, 2009 Share Posted November 26, 2009 can you tell me what is wrong with this. When I try to import it into a table, I get this error SQL query: -- -- Dumping data for table `bike` -- INSERT INTO bike( 'pk_bikeID', 'model', 'year', 'size', 'rate', 'quantity' ) VALUES ( 1, 'road', '2009', '40', '15', '40' ) , ( 2, 'mountain bike', '2009', '30', '15', '20' ) , ( 3, 'dirt bike', '2010', '10', '15', '30' ) ; MySQL said: #1064 - 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 ''pk_bikeID','model','year','size','rate','quantity') VALUES (1,'road','2009','4' at line 3 I am importing the sql file, very short. I have attached the file for convienence [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/182974-help-with-this-insert/ Share on other sites More sharing options...
kickstart Posted November 26, 2009 Share Posted November 26, 2009 Hi You have single quotes around the field names. Either use nothing around them or use back ticks (ie, use ` rather than ') All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/182974-help-with-this-insert/#findComment-965860 Share on other sites More sharing options...
CyberShot Posted November 26, 2009 Author Share Posted November 26, 2009 ok that worked, but now I am getting another error that says unknown column SQL query: -- -- Database: `bikesite` -- -- -------------------------------------------------------- -- -- Table structure for table `bike` -- -- -- Dumping data for table `bike` -- INSERT INTO bike( `pk_bikeID` , `model` , `year` , `size` , `rate` , `quantity` ) VALUES ( 1, `road` , `2009` , `40` , `15` , `40` ) , ( 2, `mountain bike` , `2009` , `30` , `15` , `20` ) , ( 3, `dirt bike` , `2010` , `10` , `15` , `30` ) ; MySQL said: #1054 - Unknown column 'road' in 'field list' I matched them up and don't see what the issue is Quote Link to comment https://forums.phpfreaks.com/topic/182974-help-with-this-insert/#findComment-965863 Share on other sites More sharing options...
CyberShot Posted November 26, 2009 Author Share Posted November 26, 2009 Thanks for your help, I solved it using double quotes on the values and the backtick on the field names. Quote Link to comment https://forums.phpfreaks.com/topic/182974-help-with-this-insert/#findComment-965867 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.