Go it fixed. I used the same code to a degree, but use the array items as
needed by just accessing $val[1], $val[2] etc. so if I need a custom select
with in the loop I access the array

Insert into mytable (item,product) values ($val[1],$val[2]);

Dustin Wish
System Engineer & Programmer
INDCO Networks
Pres. OSSRI
Pres. WTA Arkansas
********************************************************
"Do not go where the path may lead, go instead
 where there is no path and leave a trail."
Ralph Waldo Emerson (1803-1882)
***********************************************

-----Original Message-----
From: Jim Grill [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 24, 2004 10:32 AM
To: [EMAIL PROTECTED]
Cc: PHP General List
Subject: Re: [PHP] csv inssue

> Well it was very close the only issue is the trailing comma on the
inserts.
> See below:
>
> INSERT INTO mytable (one,two,three,four,five) VALUES(14,Radial H714
> 155/80r13s,26,
> All Season
> S Rated
> UTQG: 380/A/B
> WSW: White Sidewall
>
> 4 groove version of all-season performance radial. The unique tread
pattern
> disperses water to the sides of the tire while the extra-wide grooves
> enhance wet handling and braking.,H714_4g.jpg),
>
> INSERT INTO mytable (one,two,three,four,five) VALUES(14,Radial H714
> 155/80r13s,26,
> All Season
> S Rated
> UTQG: 380/A/B
> WSW: White Sidewall
>
> 4 groove version of all-season performance radial. The unique tread
pattern
> disperses water to the sides of the tire while the extra-wide grooves
> enhance wet handling and
>
braking.,H714_4g.jpg),(www.hankooktireusa.com/products_view_info.asp?Item_ID
> =21&CatID=4,25 14,Radial H714 175/65r14s,37,
> All Season
> S Rated
> UTQG: 380/A/B
> WSW: White Sidewall
>
> 4 groove version of all-season performance radial. The unique tread
pattern
> disperses water to the sides of the tire while the extra-wide grooves
> enhance wet handling and braking.),

Damn... You remind me that I need to rotate my tires this weekend. :-)

You did something wrong. :-)  There should only ever be one single query
that should look like:

$query = 'INSERT INTO mytable (one,two,three,four,five) VALUES
("blah","blah","blah","blah","blah"),
("blah","blah","blah","blah","blah"),
("blah","blah","blah","blah","blah"),
("blah","blah","blah","blah","blah"),
("blah","blah","blah","blah","blah")';

Also, I did forget the quotes on the values. This will fix that: $query .=
'("'.implode('","',$vals).'"),';

There is a line that gets rid of the the trailing comma:
/*kill the last comma*/
$query = substr($query, 0, -1);

Take another look and then post some code if you still have trouble.

Jim Grill

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to