You are here:  » Importing data to a mysql that contains multiple csv's, one feed no headers


Importing data to a mysql that contains multiple csv's, one feed no headers

Submitted by dflsports on Wed, 2006-01-25 05:00 in

I'm getting my money's worth here :)

I am importing mutiple feeds from different sources. Some of the feeds have no headers, some do. I have a table set up and can import the data with headers with no problems. But I have feeds with no headers. how can I import them inot the table with the rest of the data?

so I have something like this now

Price = '".mysql_real_escape_string( $product["Product Price"] )."',
Category = '".mysql_real_escape_string( $product["category"] )."',
ImageURL = '".mysql_real_escape_string( $product["thumbnail image url"] )."',

How should the below look?

Price = '".mysql_real_escape_string( $product["what goes here?"] )."',

Many thanks!

Don

Submitted by support on Wed, 2006-01-25 08:24

Hi Don,

CSV files with no header row are automatically given the field names FIELD1,FIELD2,...,FIELDn. The easiest thing to do would be to upload the feed to the demo page; or use the basic file analysis example to see which field names to use.

Once you know which field number contains the field you want, your code for the headerless feed would look something like this:

Price = '".mysql_real_escape_string( $product["FIELD3"] )."',

Hope this helps!
David.

Submitted by dflsports on Wed, 2006-01-25 22:27

Thanks, that's exactly what I needed to know! You never disappoint :)