odbc_execute Execute a prepared statement


odbc_execute

(PHP 4, PHP 5)

odbc_executeExecute a prepared statement

说明

bool odbc_execute ( resource $result_id [, array $parameters_array ] )

Executes a statement prepared with odbc_prepare().

参数

result_id

The result id resource, from odbc_prepare().

parameters_array

Parameters in parameter_array 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 parameter_array 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.

If you wish to store a string which actually begins and ends with single quotes, you must add a space or other non-single-quote character to the beginning or end of the parameter, which will prevent the parameter from being taken as a file name. If this is not an option, then you must use another mechanism to store the string, such as executing the query directly with odbc_exec()).

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE.

范例

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, mssql for MS SQL Server, or oci8 for Oracle).

更新日志

版本 说明
4.2.0 File reading is now subject to 安全模式 and open-basedir restrictions in parameters_array.
4.1.1 Remote files are no longer supported in parameters_array.

参见


«  odbc_exec
» odbc_fetch_array
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3