camdenite Posted February 3, 2009 Share Posted February 3, 2009 Hi all, I tried adding a unique id to a table that already existed but I keep getting "Invalid Field Count" when I upload the csv. Please tell me what I am missing. I added blog_id and the id in the insert. Cheers, Colin. CREATE TABLE `blogb` ( `blog_id` INT unsigned NOT NULL auto_increment, `date1` varchar( NOT NULL, `date2` varchar( NOT NULL, `heading` varchar(60) NOT NULL, `category_id` varchar(4) NOT NULL, `first_para` text NOT NULL, `entry` text NOT NULL, `more` text NOT NULL, `image1` varchar(100) NOT NULL, `image2` varchar(100) NOT NULL, `image3` varchar(100) NOT NULL, `image4` varchar(100) NOT NULL, `publish` varchar( NOT NULL, `pub2` enum('yes','no') NOT NULL default 'no', UNIQUE KEY (email), KEY `date1` (`date1`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; And here is the csv: "1";"20080724";"24.07.08";"This is a test";;"Testing one two three ...";"<strong>polly wants a cracker</strong> ";;;;;;;"no" Quote Link to comment https://forums.phpfreaks.com/topic/143620-solved-invalid-field-count/ Share on other sites More sharing options...
Zhadus Posted February 3, 2009 Share Posted February 3, 2009 You should not insert the blog_id. Also, you don't have enough values to fill all the 'NOT NULL' fields. Quote Link to comment https://forums.phpfreaks.com/topic/143620-solved-invalid-field-count/#findComment-753533 Share on other sites More sharing options...
camdenite Posted February 3, 2009 Author Share Posted February 3, 2009 Hi Zhadus, Thanks for that. I have tried this: "";"20080724";"24.07.08";"This is a test";;"Testing one two three ...";"<strong>polly wants a cracker</strong> ";;;;;;;"no" "";"20080905";"05.09.08";"another";"02";"connecting with this ole shaboodle is proving problematic";"<p>well here i am just wondering what to do!</p>";;"ok";"";;;;"no" and this: ;"20080724";"24.07.08";"This is a test";;"Testing one two three ...";"<strong>polly wants a cracker</strong> ";;;;;;;"no" ;"20080905";"05.09.08";"another";"02";"connecting with this ole shaboodle is proving problematic";"<p>well here i am just wondering what to do!</p>";;"ok";"";;;;"no" and this: "20080724";"24.07.08";"This is a test";;"Testing one two three ...";"<strong>polly wants a cracker</strong> ";;;;;;;"no" "20080905";"05.09.08";"another";"02";"connecting with this ole shaboodle is proving problematic";"<p>well here i am just wondering what to do!</p>";;"ok";"";;;;"no" I'm not sure what else to do. Thankyou for your help. Quote Link to comment https://forums.phpfreaks.com/topic/143620-solved-invalid-field-count/#findComment-753539 Share on other sites More sharing options...
premiso Posted February 3, 2009 Share Posted February 3, 2009 Anything, such as the image1-4, that may not have a value allow it to be NULL instead of NOT NULL. Quote Link to comment https://forums.phpfreaks.com/topic/143620-solved-invalid-field-count/#findComment-753545 Share on other sites More sharing options...
revraz Posted February 3, 2009 Share Posted February 3, 2009 In your table design, you are setting your field properties to "NOT NULL" which means you cannot insert a NULL into it. Every line you have ;;; in a row, those are NULL entries. So either change your fields to allow NULLS or put values in every field. Quote Link to comment https://forums.phpfreaks.com/topic/143620-solved-invalid-field-count/#findComment-753547 Share on other sites More sharing options...
camdenite Posted February 3, 2009 Author Share Posted February 3, 2009 Cheers for that. I got it sorted Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/143620-solved-invalid-field-count/#findComment-753860 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.