Re: confused big time
| From: | Red Wingate | Date: | Wed, 07 Apr 2004 18:53:39 +0000 |
| Subject: | Re: confused big time | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-182687@lists.php.net to get a copy of this message | ||
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.
[...]