function dbConnect() { //opens db connection global $conn; $conn = @mysql_connect($GLOBALS['DB']['dbhost'],$GLOBALS['DB']['dbuser'],$GLOBALS['DB']['dbpass']) or trigger_error("SQL", E_USER_ERROR); @mysql_select_db($GLOBALS['DB']['database'],$conn) or trigger_error("SQL", E_USER_ERROR); //try to connect to db } function dbClose() { //closes db connection @mysql_close($GLOBALS['conn']); //Close connection } function dbSelect($strQuery, &$bTrigger, &$aArray) { global $strQry; $strQry = $strQuery; if ($strQry) { //if query string exists then continue dbConnect(); $SearchQuery = @mysql_query($strQry,$GLOBALS['conn']) or trigger_error("SQL", E_USER_ERROR); if (@mysql_num_rows($SearchQuery) == 0) { $bTrigger = False; } else { $bTrigger = True; while($row = @mysql_fetch_array($SearchQuery)) { $aArray[] = $row; } } dbClose(); } else $bTrigger = false; } function dbGeneral($strQuery, $srcTable, &$lastID) { global $strQry; $strQry = $strQuery; if ($strQry) { //if query string exists then continue dbConnect(); $UpdateQuery = mysql_query($strQry,$GLOBALS['conn']) or trigger_error("SQL", E_USER_ERROR); if ($srcTable) $lastID = mysql_insert_id(); dbClose(); } }