Database Wrapper - A PHP Script that makes database interactions simpler.
A PHP Script that makes database interactions simpler.
This script currently supports the following Database Server Types:
Basic descriptions of the available functions:
Count(String $sql)
- Retrieves an integer count from the database based on a Sql "Count" statement.
Create_Database(String $database_name)
MySql:
- Creates a new database given a valid Server, Server Port, Username and Password.
PostgreSQL:
- Creates a new database given a valid Server, Server Port, Username, Password and Existing Database.
- Upon success, the new database is set as the target database for the Database Wrapper instance and 'True' is returned. If creation of the new database fails, error messages are displayed and 'False' is returned.
Get_Insert_ID()
- Upon creation of a new record, this function retrieves the value of an Auto Increment (MySql) / Serial (PostgreSQL) field of the new record. Used in conjunction with an "INSERT INTO" Sql statement.
Get_Record(String $sql_query)
- Retrieves a single dimensional, key-value pair array from the database.
Get_Recordset(String $sql_query)
- Retrieves a multi-dimensional, key-value pair array from the database.
is_Connected()
- Pings the Database Server Connection and returns True upon a valid connection and False upon failure.
Run_Query(String $sql_query)
- Runs a Sql Query and returns True upon success and False if the query fails.
Set_Database(String $database_name)
- Verifies the new database using the current Server, Server_Port, Username and Password. Upon successful verification, the new database is set to the target database and 'True' is returned. Upon failure of verification, an error message is displayed and 'False' is returned.