dbi4php API
| Name: | dbi_connect |
| Description: | Establishes a connection to the database. |
| Parameters: |
| host: | Database server name (or localhost) |
| login: | Database user login (if required) |
| password: | Database user password (if required) |
| database: | Database tablespace name |
|
| Returns: | The connection variable (needed for dbi_close) |
| Name: | dbi_close |
| Description: | Closes the connection to the database. |
| Parameters: |
| conn: | The connection variable returned from dbi_connect |
|
| Returns: | result of close (true = success) |
| Name: | dbi_query |
| Description: | Makes a SQL query |
| Parameters: |
| sql: | The SQL to execute. This can be an INSERT, DELETE, UPDATE, or any other valid SQL request. |
| fatalOnError*: | Should the application exit on a fatal error? |
| showError*: | Should the message from the database be shown to the user? |
|
| Returns: | On success, this will return a query result variable. On failure, this will return false. |
| Name: | dbi_fetch_row |
| Description: | Fetches the next row of data from the database |
| Parameters: |
| res: | The resource variable returned from dbi_query or dbi_execute |
|
| Returns: | Returns a row of data from the database or false if there are no more rows. |
| Name: | dbi_affected_rows |
| Description: | Returns the number of rows affected from the previous dbi_query or dbi_execute call. |
| Parameters: |
| conn: | The database connection returned from dbi_open |
| res: | The query resource variable returned from either dbi_query or dbi_execute |
|
| Returns: | Returns the number of rows affected from the previous dbi_query or dbi_execute call. |
| Name: | dbi_update_blob |
| Description: | Updates a blob column in the database |
| Parameters: |
| table: | The table name that contains the blob |
| column: | The column name of the blob |
| key: | The key to identify the proper row in the table. (Example: "id=4" or "id=4 AND user='craig'") |
|
| Returns: | Returns true on success |
| Name: | dbi_get_blob |
| Description: | Gets the binary data of a blob column in the database |
| Parameters: |
| table: | The table name that contains the blob |
| column: | The column name of the blob |
| key: | The key to identify the proper row in the table. (Example: "id=4" or "id=4 AND user='craig'") |
|
| Returns: | Returns the binary data on success and false on failure. |
| Name: | dbi_free_result |
| Description: | Frees up the query result resource |
| Parameters: |
| res: | The result variable returned from either dbi_query or dbi_execute |
|
| Returns: | Returns true on succes, false on failure |
| Name: | dbi_error |
| Description: | Returns the error message from the last error |
| Parameters: | None |
| Returns: | Returns the error message from the last error |
| Name: | dbi_escape_string |
| Description: | Inserts the proper escape sequence for a SQL value for use with dbi_query. You do not need to use this function with dbi_execute since values do not need escaping for that function. |
| Parameters: |
| string: | The string to escape |
|
| Returns: | Returns the properly escaped string value |
| Name: | dbi_execute |
| Description: | Executes the specified SQL query. This function is very similar to dbi_query. However, it uses prepared statements instead of a standard SQL string. You do not need to escape characters (quotations, for example) when calling this function. Because of this, this function is more secure than dbi_query and should be the preferred way to make queries. |
| Parameters: |
| sql: | The SQL command with '?' as place holders for values.
For example: INSERT INTO xxx VALUES ( ?, ?, ? ) |
| params: | An array of parameters that correspond to the '?' place holders in the sql parameter. The values do not need to be escaped (unlike dbi_query) for quotes and other characters. |
| fatalOnError*: | Should the application exit on a fatal error? |
| showError*: | Should the message from the database be shown to the user? |
|
| Returns: | On success, this will return a query result variable. On failure, this will return false. |
|
|
|