I've tried odbc_prepare()
+ odbc_execute()
to update a record in an Access file but I always get an SQL state 07001
error message about incorrect column count (actually, the message is in Spanglish and doesn't make much sense):
<?php
$items = array();
$items[100] = 'Foo';
$items[200] = 'Bar';
$sql = 'UPDATE street
SET name=?
WHERE street_id=?';
$stmt = odbc_prepare($conection, $sql);
if( $stmt===FALSE ){
die(odbc_errormsg());
}
foreach($items as $cod => $name){
if( !odbc_execute($stmt, array($name, $cod)) ){
die(odbc_errormsg());
}
}
User comments at http://es2.php.net/manual/en/function.odbc-execute.php suggest that Microsoft Access ODBC drivers do not support parameterized queries. However, I haven't found an odbc_* function to escape data.
So... How can I escape input data?