You could even do:

$sql .= " ( '".implode( "','" , $a )."' )";

This way everything is quoted though ( but this doesn't matter using
MySQL anyway ).
If you want to escape the values of $a you could use array_map to
do this also without having to loop :-)

  -- red

[...]
> To get your list of columns, you could do this:
>
> $column_list = implode(',',array_keys($a));
> $sql = "INSERT INTO $tablename ($column_list) VALUES ";
>
> That way you only have to loop through $a once.
[...]

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

Reply via email to