Re: Creating INSERT INTO statement from dbf file
| From: | Richard Lynch | Date: | Wed, 06 Apr 2005 01:46:30 +0000 |
| Subject: | Re: Creating INSERT INTO statement from dbf file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-212330@lists.php.net to get a copy of this message | ||
On Mon, April 4, 2005 1:33 pm, Rahul S. Johari said:
> It works fine, except for one problem. It¹s able to create the INSERT INTO
> sql statement, with all the fields and corresponding values, but as I¹m
> running a loop for both the fields names, and the values corresponding to
> fields names, it leaves a comma after the records are over.
If having a flag to determine when to add the , or ' feels too kludgy, you
could also do something like:
$values = array();
while ($value...){
$values[] = $value;
}
$values_sql = implode(", ", $values);
It's a bit more memory-intensive than just chopping up a string, but I
find it more understandable, personally. Others will differ, of course.
--
Like Music?
http://l-i-e.com/artists.htm