|
db2_bind_param
Binds a PHP variable to an SQL statement parameter
(PECL ibm_db2:1.0-1.6.2)
Example 913. Binding PHP variables to a prepared statement
The SQL statement in the following example uses two input parameters in
the WHERE clause. We call db2_bind_param() to bind two
PHP variables to the corresponding SQL parameters. Notice that the PHP
variables do not have to be declared or assigned before the call to
db2_bind_param(); in the example,
<?php The above example will output: Pook, cat, 3.2 Example 914. Calling stored procedures with IN and OUT parametersThe stored procedure match_animal in the following example accepts three different parameters:
In addition, the stored procedure returns a result set consisting of the animals listed in alphabetic order starting at the animal corresponding to the input value of the first parameter and ending at the animal corresponding to the input value of the second parameter. <?php The above example will output: Values of bound parameters _before_ CALL: Example 915. Inserting a binary large object (BLOB) directly from a fileThe data for large objects are typically stored in files, such as XML documents or audio files. Rather than reading an entire file into a PHP variable, and then binding that PHP variable into an SQL statement, you can avoid some memory overhead by binding the file directly to the input parameter of your SQL statement. The following example demonstrates how to bind a file directly into a BLOB column. <?php |
Change Languagedb2_autocommit db2_bind_param db2_client_info db2_close db2_column_privileges db2_columns db2_commit db2_conn_error db2_conn_errormsg db2_connect db2_cursor_type db2_escape_string db2_exec db2_execute db2_fetch_array db2_fetch_assoc db2_fetch_both db2_fetch_object db2_fetch_row db2_field_display_size db2_field_name db2_field_num db2_field_precision db2_field_scale db2_field_type db2_field_width db2_foreign_keys db2_free_result db2_free_stmt db2_get_option db2_lob_read db2_next_result db2_num_fields db2_num_rows db2_pconnect db2_prepare db2_primary_keys db2_procedure_columns db2_procedures db2_result db2_rollback db2_server_info db2_set_option db2_special_columns db2_statistics db2_stmt_error db2_stmt_errormsg db2_table_privileges db2_tables |