|
|
|
| Title : |
A very simple database abstraction layer for the PHP 3.0 ODBC module. |
| Categories : |
ODBC, PHP |
 Stig Bakken |
| Date : |
Apr 12th 1998 |
| Grade : |
2 of 5 (graded 3 times) |
| Viewed : |
5393 |
| File : |
No file for this code example. |
| Images : |
No Images for this code example. |
|
| Search : |
More code by Stig Bakken |
|
| Action : |
Grade This Code Example
|
|
| Tools : |
My Examples List |
|
|
|
|
|
|
<?
/*
* Function: db_connect
* Arguments: $host (string) - database host to connect to
* $database (string) - database name
* $user (string) - database user
* $password (string) - database user`s password
* Description: connects to a database
* Returns: (int) connection identifier
*/
function db_connect($dsn, $user, $password)
{
return odbc_connect($dsn, $user, $password);
}
/*
* Function: db_query
* Arguments: $conn (int) - connection identifier
* $query (string) - SQL statement to execute
* Description: executes an SQL statement
* Returns: (int) 0 - query failed
* 1 - query succeeded
*/
function db_query($conn, $query)
{
return odbc_exec($conn, $query);
}
/*
* Function: db_fetch_row
* Arguments: $result (int) - result identifier
* Description: Returns an array containing data from a fetched row.
* Returns: (int) 0 - error
* (array) - returned row
*/
function db_fetch_row($result)
{
$row = array();
$cols = odbc_fetch_into($result, &$row);
if (!$cols) {
return 0;
}
return $row;
}
/*
* Function: db_free_result
* Arguments: $result (int) - result identifier
* Description: Frees all memory associated with a result identifier.
* Returns: (int) 0 - failure
* 1 - success
*/
function db_free_result($result)
{
return odbc_free_result($result);
}
/*
* Function: db_disconnect
* Arguments: $connection (int) - connection identifier
* Description: closes a database connection
* Returns: (int) 0 - failure
* 1 - success
*/
function db_disconnect($connection)
{
return odbc_close($connection);
}
?> |
|
| A set of functions sitting on top of the abstraction layer that makes it a little easier to do SQL stuff. Documentation is within Categories : Databases, ODBC, Complete Programs, PHP | | | UDMSearch - a free search engine, indexing system. Categories : Search Engines, Linux, PHP, MySQL, ODBC | | | odbc_autocommit -- Toggle autocommit behaviour Categories : PHP, PHP Functions, ODBC | | | How to access MS Excel spread sheets from PHP Categories : PHP, Excel, ODBC, Databases | | | How to connect to MS SQL 6.x+ database server via ODBC functions of
PHP3 compiled with iODBC and Openlink drivers under Linux. Categories : Databases, MS SQL Server, PHP, ODBC | | | This is a small Web Phone Database which is written in PHP3
and utilizes a ODBC Data Source. Categories : PHP, ODBC | | | Dynamic WHERE CLAUSE depending on number of FORM FIELDS Categories : ODBC, General SQL, PHP, Complete Programs, Databases | | | Voting Machine with Access 97 Categories : PHP, ODBC, WinNT, MS Access, Complete Programs | | | Query2Report : Generating Html, Pdf and Csv Reports from SQL Query Categories : PHP, PHP, HTML, PDF, Excel | | | Modification of Shane Caraveo's guestbook. Uses ODBC...some code modifications Categories : ODBC, Databases, Complete Programs, PHP | | | Forum with Access 97 Categories : MS Access, Complete Programs, PHP, ODBC, WinNT | | | Connects to DSN `LocalServer`, selecting something, and outputing fields 1, 2. Categories : ODBC, PHP | | | php for odbc /* connect to access from odbc */ Categories : PHP Classes, ODBC, MS Access, PHP | | | db2tab.php - Simple scripts to access IBM DB2 Universal DataBase tables through PHP ODBC funtions. Categories : Databases, PHP, ODBC | | | ADODB Database Wrapper Abstraction Library for PHP: MySQL, MSSQL,
Oracle, Interbase,ODBC, Microsoft Access and FoxPro. Categories : PHP Classes, Databases, PHP, General SQL, ODBC | |
|
|
|