Thundarfoot Posted January 19, 2008 Share Posted January 19, 2008 How hard would it be to make a script to fill a mysql table from the contents of a comma delemeted .csv text file (I am willing to cut and paste out of the file, or whatever) The file is not wanting to import via phpmyadmin improper field count, I am not sure why and curious as to learning to do it the manual way anyway. Thanks in advance for any help you can lend Quote Link to comment https://forums.phpfreaks.com/topic/86768-solved-script-import-csv/ Share on other sites More sharing options...
AndyB Posted January 19, 2008 Share Posted January 19, 2008 Not hard at all. But the problem of having more/less data than fields in the database will still exist. Fix that first. Quote Link to comment https://forums.phpfreaks.com/topic/86768-solved-script-import-csv/#findComment-443468 Share on other sites More sharing options...
Thundarfoot Posted January 19, 2008 Author Share Posted January 19, 2008 One of the fields in the table contains text with blank lines in it, //Like this// I thought that was causing the import to think line one was over, when it really was not....am I mistaken? Quote Link to comment https://forums.phpfreaks.com/topic/86768-solved-script-import-csv/#findComment-443469 Share on other sites More sharing options...
Thundarfoot Posted January 19, 2008 Author Share Posted January 19, 2008 this is one record 26 fields as cut from the .csv file 26,24,9,2,0,127.0.0.1,1200730672,1,0,1,1,1,1,A,Acid Spray Card,"Class: [/color:1c4kdtgz] No Image Drop Unknown[/color:1c4kdtgz]",bda4add646274bc8674445475caadae6,0,Cg==,1c4kdtgz,1,0,,0,0,0 Quote Link to comment https://forums.phpfreaks.com/topic/86768-solved-script-import-csv/#findComment-443482 Share on other sites More sharing options...
AndyB Posted January 19, 2008 Share Posted January 19, 2008 You may have better luck if you open the .csv file in Excel and change the style of cells to not wrap. Editing the raw data in Excel is probably the easiest way to clean it up, preparatory to importing it via phpMyAdmin. Quote Link to comment https://forums.phpfreaks.com/topic/86768-solved-script-import-csv/#findComment-443486 Share on other sites More sharing options...
Thundarfoot Posted January 19, 2008 Author Share Posted January 19, 2008 thank you for the advice, taking out word wrap, and replacing the blank lines with <br> worked like a charm! Quote Link to comment https://forums.phpfreaks.com/topic/86768-solved-script-import-csv/#findComment-443522 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.