Re: PHP/MySQL and parameterized queries
| From: | Richard Lynch | Date: | Tue, 09 Jul 2002 04:48:03 +0000 |
| Subject: | Re: PHP/MySQL and parameterized queries | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-106290@lists.php.net to get a copy of this message | ||
>Does MySQL support parameterized queries (e.g., "INSERT INTO table
>(Col1,Col2) VALUES (?,?)"), and if so, is there a PHP function that allows
>you to create and attach parameters to MySQL queries?
I don't believe MySQL supports that, so there's no PHP mechanism for it.
However, you *can* insert a bunch of rows at once with something like:
$query = "insert into table (col1, col2) values (1, 2), (3, 4), (5, 6)";
I don't guarantee I got the MySQL syntax correct, though.
This is, however, not supported under other database engines, so be aware
that you'll need to alter it if you ever move to something other than MySQL.
--
Like Music? http://l-i-e.com/artists.htm