Having trouble importing a tab delimited file

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
thinkadvertising
Forum Newbie
Posts: 3
Joined: Thu May 08, 2008 10:47 am

Having trouble importing a tab delimited file

Post by thinkadvertising »

I'm having a hard time importing a tab delimited file. I get an error when I try to write the line to my table. I'm told that the column count doesn't match the value count. I output the column count for the row and the number matches what I've got in my table (83 columns in both).

Now, this data is formatted kind of strangely. There are multiple tabs in a row (right next to each other). This isn't just a null field, but just extra tabs. For example, there is a field for annual taxes, then the next field is for property options. There is no data in between those two pieces of data. However, there are 12 blank columns when I open that file up in Excel. I'm guessing that means there are 12 tabs right there. To get around this strange formatting, I added blank fields in my table (blank1, blank2, etc). I was getting the column count and value count don't match error, and though this might fix it.

It didn't. I have 83 columns and values (it seems), but I still get that error. I tried importing the file with phpmyadmin, to see if it would work. But I get the same error. Can anyone help me out here? I've tried using the fgetcsv() function and I just can't get it to work. Help.
rvijay_eee
Forum Newbie
Posts: 4
Joined: Tue May 13, 2008 4:16 am

Re: Having trouble importing a tab delimited file

Post by rvijay_eee »

Open it in excel and save it in csv format. In csv format, fields will be enclosed by double qoutes and separated by commas.

So there wont be any problem in importing the file
Post Reply