Re: csv inssue

From: Date: Fri, 24 Sep 2004 15:31:38 +0000
Subject: Re: csv inssue
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-197785@lists.php.net to get a copy of this message
> 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

« previous php.general (#197785) next »