Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - Programming » SQL Anywhere PHP API » SQL Anywhere PHP API reference

sqlanywhere_errorcode Next Page

sqlanywhere_execute


Prototype

bool sqlanywhere_execute( resource link_identifier, string sql_str )

Description

Prepares and executes the SQL query sql_str on the connection identified by the link_identifier that has already been opened using sqlanywhere_connect or sqlanywhere_pconnect. This function returns true or false depending on the outcome of the query execution. This function is suitable for queries that do not return result sets. If you are expecting a result set, use the sqlanywhere_query function instead.

Parameters

link_identifier    A link identifier returned by sqlanywhere_connect or sqlanywhere_pconnect.

sql_str    A SQL query.

Returns

True if the query executed successfully, otherwise, false and an error message.

Example

This example shows how to execute a DDL statement using the sqlanywhere_execute function.

if( sqlanywhere_execute( $conn, "CREATE TABLE my_test_table( INT id )" ) ) {
   // handle success
} else {
   // handle failure
}
Related functions