★ wanayoo — archive 1999 http://www.php.net/manual/function.odbc-prepare.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to ODBC
Quick Reference
German version of this pageJapanese version of this pageItalian version of this pageFrench version of this pageHungarian version of this page
ODBC
* odbc_autocommit
* odbc_binmode
* odbc_close
* odbc_close_all
* odbc_commit
* odbc_connect
* odbc_cursor
* odbc_do
* odbc_exec
* odbc_execute
* odbc_fetch_into
* odbc_fetch_row
* odbc_field_name
* odbc_field_num
* odbc_field_type
* odbc_field_len
* odbc_field_precision
* odbc_field_scale
* odbc_free_result
* odbc_longreadlen
* odbc_num_fields
* odbc_pconnect
* odbc_prepare
* odbc_num_rows
* odbc_result
* odbc_result_all
* odbc_rollback
* odbc_setoption
* odbc_tables
* odbc_tableprivileges
* odbc_columns
* odbc_columnprivileges
* odbc_gettypeinfo
* odbc_primarykeys
* odbc_foreignkeys
* odbc_procedures
* odbc_procedurecolumns
* odbc_specialcolumns
* odbc_statistics
Manual: odbc_prepare
View the source code for this pageSearch the site



Previous page
 odbc_pconnect
 Updated
Sat, 12 Aug 2000
odbc_num_rows 
Next page


odbc_prepare

(PHP3 >= 3.0.6, PHP4 )

odbc_prepare -- Prepares a statement for execution

Description

int odbc_prepare (int connection_id, string query_string)

Returns false on error.

Returns an ODBC result identifier if the SQL command was prepared successfully. The result identifier can be used later to execute the statement with odbc_execute().


User Contributed Notes: odbc_prepare


kassick@cpovo.net
19-Mar-2000 09:35
Throws an error when connecting via iODBC to MySQL
"Using static cursors instead of requested type, SQL state 01S02 in
SQLSetStmtOption"



chien_ta_ching@ureach.com
30-Mar-2000 02:42
Got the same error from DB2's ODBC implementation (running on Solaris 260). Error message "Warning: SQL error: [IBM][CLI Driver] CLI0005W Option value changed. SQLSTATE=01S02, SQL state 01S02 in SQLPrepare".

Replace odbc_prepare & odbc_execute with odbc_do as follows:

<?
// Using odbc_prepare & odbc_execute
$conn_id = odbc_connect('ODBC_DSN','USER','PASSWORD');
$stmt = odbc_prepare($conn_id,"select count(*) from test_table");
$exe_id = odbc_execute($stmt);
$answer = odbc_result($stmt, 1);

odbc_close($conn_id);
?>

<?
// Replace with odbc_do
$conn_id = odbc_connect('ODBC_DSN','USER','PASSWORD');
$exe_id = odbc_do($conn_id, "select count(*) from test_table");
$answer = odbc_result($exe_id, 1);

odbc_close($conn_id);
?>



 About Notes


Previous page
 odbc_pconnect
 Updated
Sat, 12 Aug 2000
odbc_num_rows 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.