Right well i thought that seeing as i am creating a complete application i thought i would write my own db class just done a little bit of it and i am getting a nice error of
Fatal error: Call to undefined function mysql_connect() in *:\****************\database.engine.php on line 61
it is proberbly a nice and easy error to work out but i am kinda brain dead atm so....
<?php
/*
+++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Acid Avengers Software +++
+++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Product: Acid Forum +++
+++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Website: http://www.acidavengers.co.uk +++
+++ E-Mail: support@acidavengers.co.uk +++
+++++++++++++++++++++++++++++++++++++++++++++++++++
+++ Created By: Marc "Acid Burn" Towler +++
+++ Copyright 2006 - 2007 Acid Avengers +++
+++++++++++++++++++++++++++++++++++++++++++++++++++
+++ File Name: database.engine.php +++
+++ File Version: 0.1 +++
+++++++++++++++++++++++++++++++++++++++++++++++++++
_______________________________________________________________________
/***********************************************************************\
|*** File Description ***|
|***********************************************************************|
|*** This class servers as an interim between the PHP system and a ***|
|*** database protocol. Initially this class will only handle MySQL, ***|
|*** MySQLi and SQLite, the reason for SQLite support at an inital ***|
|*** stage is to allow a backup system to be implimented from the ***|
|*** start. Later support will be given to PDO, PEAR DB and pgSQL. ***|
|*** Oracle and MSSQL will be supported optionally at a later date ***|
|***********************************************************************|
\_______________________________________________________________________/
*/
class databaseEngine {
//Construct obtains and then connects to the database
function __construct($host = 'localhost', $user = '', $pass = '', $port = 3306, $db = '')
{
//check to see that everything is present, if not show error
if($user == '' || $pass == '' || $db == '')
{
$this->error = 1; //set the error flag
$this->errormsg = 'Database unable to connect, insufficent details';
$this->errorno = 0001; //set to a non-mysql error number
return false;
}
//Must be ok so lets connect
$this->dbConnect($host, $user, $pass, $port, $db);
}
//Destruct closes and cleans up any MySQL bits
function __destruct()
{
}
//dbConnect function uses mysql_connect
function dbConnect($host, $user, $pass, $port, $db)
{
if($port == 3306)
{
$return = mysql_connect($host, $user, $pass);
if($return)
{
return $this->selectDB($db);
}
} else {
//Not the standard port so need to use the format host:port
$host = $host . ":" . $port;
$return = mysql_connect($host, $user, $pass);
if($return)
{
return $this->selectDB($db);
}
}
}
//selectDB function uses mysql_select_db
function selectDB($db)
{
$result = mysql_select_db($db);
return $result;
}
//query function uses mysql_query
function query($sql)
{
$result = mysql_query($sql);
return $result;
}
//fetchArray function uses mysql_fetch_array
function fetchArray()
{
}
//free function uses mysql_free_result to free the resultset
function free()
{
}
//affectedRows function uses mysql_affected_rows
function affectedRows()
{
}
//pConnect uses mysql_pconnect to make a persistant connection
function pConnect()
{
}
//error function checks, logs and if set shows errors in a friendly manner
function error()
{
}
}
?>