Microsoft Access prepared statement with parameters problem
| From: | Chris Poirier | Date: | Sat, 03 Mar 2001 12:11:53 +0000 |
| Subject: | Microsoft Access prepared statement with parameters problem | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-5801@lists.php.net to get a copy of this message | ||
Hi there,
I'm attempting to execute prepared statements with parameters against an
Access 97 database, and am having some trouble. I'm sure I'm missing
something really obvious, but I just can't see it, and I'm hoping someone
out there can help.
In the following code, assume that $connection holds a valid and otherwise
working connection to a database in which there exists a table named
System. Column A is a text column.
$statement = odbc_prepare( $connection, "select * from System where A=?" );
if( odbc_execute( $statement, array( "MachineID" )))
{
odbc_fetch_row( $statement );
print odbc_result( $statement, "A" ) . "<br/>";
}
I have tried many variations on this code, and if there are any ? marks in
the query, regardless what I pass as the second parameter to
odbc_execute(), odbc_execute() always dies with the following message:
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver]COUNT field
incorrect , SQL state 07001 in SQLExecute in ...
Can anyone tell me what I'm doing wrong?
Thanks, Chris.