Re: Creating INSERT INTO statement from dbf file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux