(PHP 4, PHP 5, PHP 7, PHP 8)
odbc_execute — Execute a prepared statement
odbc_execute(Odbc\Result $statement, array $params = []): bool
Executes a statement prepared with odbc_prepare().
statementThe ODBC result object from odbc_prepare().
params Parameters in params will be substituted for placeholders in the prepared statement in order. Elements of this array will be converted to strings by calling this function.
Any parameters in params which start and end with single quotes will be taken as the name of a file to read and send to the database server as the data for the appropriate placeholder.
| Version | Description |
|---|---|
| 8.4.0 | This function returns an Odbc\Result instance now; previously, a resource was returned. |
| 8.0.0 | The unused flags parameter was removed. |
Example #1 odbc_execute() and odbc_prepare() example
In the following code, $success will only be true if all three parameters to myproc are IN parameters:
<?php $a = 1; $b = 2; $c = 3; $stmt = odbc_prepare($conn, 'CALL myproc(?,?,?)'); $success = odbc_execute($stmt, array($a, $b, $c)); ?>
If you need to call a stored procedure using INOUT or OUT parameters, the recommended workaround is to use a native extension for your database (for example, oci8 for Oracle).
© 1997–2025 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/function.odbc-execute.php