saveIntoErrorLog("DBConnection.php", "DBConnection()", "mysqli_connect()", mysqli_connect_error()); return false; } // Set charset for the connection mysqli_set_charset($connection, 'utf8'); $this->connection = $connection; $this->statement = true; // With mysqli_connect, database is selected automatically return true; /*} catch (Exception $e) { $this->saveIntoErrorLog("DBConnection.php", "DBConnection()", "", $e); return false; }*/ } function CloseConnection() { //try { $close = mysqli_close($this->connection); if(!$close) { $this->saveIntoErrorLog("DBConnection.php", "CloseConnection()", "mysqli_close()"); } return true; /*} catch (Exception $e) { $this->saveIntoErrorLog("DBConnection.php", "CloseConnection()", "", $e); return false; }*/ } /** * Execute query for select */ function SelectQuery($fileName="", $methodName="") { //try { if($this->connection && $this->statement) { if(empty($this->dbQuery)) { return false; } $this->dbResult = mysql_query($this->dbQuery, $this->connection); if(!$this->dbResult) { $this->saveIntoErrorLog($fileName, $methodName, $this->dbQuery); return false; } $rowCount = 0; $resultData = array(); while($rowData = mysql_fetch_array($this->dbResult, MYSQL_ASSOC)) { $resultData[$rowCount] = $rowData; $rowCount++; } mysql_free_result($this->dbResult); return $resultData; } else { return false; } /*} catch (Exception $e) { $this->saveIntoErrorLog($fileName, $methodName, "", $e); return false; }*/ } /** * Execute query for Insert */ function InsertQuery($fileName="", $methodName="") { //try { if($this->connection && $this->statement) { if(empty($this->dbQuery)) { return false; } $this->dbResult = mysql_query($this->dbQuery, $this->connection); if(!$this->dbResult) { $this->saveIntoErrorLog($fileName, $methodName, $this->dbQuery); return false; } $id = mysql_insert_id(); mysql_free_result($this->dbResult); return $id; } else { return false; } /*} catch (Exception $e) { $this->saveIntoErrorLog($fileName, $methodName, "", $e); return false; }*/ } /** * Execute query for Update/Delete */ function ExecuteQuery($fileName="", $methodName="") { //try { if($this->connection && $this->statement) { if(empty($this->dbQuery)) { return false; } $this->dbResult = mysqli_query($this->connection, $this->dbQuery); if(!$this->dbResult) { $this->saveIntoErrorLog($fileName, $methodName, $this->dbQuery); return false; } $rows = 0; $rows = mysqli_affected_rows($this->connection); mysqli_free_result($this->dbResult); return $rows; } else { return false; } /*} catch (Exception $e) { $this->saveIntoErrorLog($fileName, $methodName, "", $e); return false; }*/ } /** * Execute queries for webservice */ function SelectQueryResult($fileName="", $methodName="") { //try { if($this->connection && $this->statement) { if(empty($this->dbQuery)) { return false; } $this->dbResult = mysql_query($this->dbQuery, $this->connection); if(!$this->dbResult) { $this->saveIntoErrorLog($fileName, $methodName, $this->dbQuery); return false; } $resultData = $this->dbResult; //mysql_free_result($this->dbResult); return $resultData; } else { return false; } /*} catch (Exception $e) { $this->saveIntoErrorLog($fileName, $methodName, "", $e); return false; }*/ } /** * Use this method to log the database errors. */ function saveIntoErrorLog($fileName="", $methodName="", $sqlQuery="", $exception="") { $errorCode = mysql_errno(); $errorText = mysql_error(); $errorMessage = "File: ".$fileName.", Method/Function: ".$methodName.", Query: ".$sqlQuery.", Error: ".$errorCode."-".$errorText; if($exception != "") $errorMessage.= " Exception : ".$exception ; // timestamp for the error entry $errorMessage = "[".date("j-M-Y H:i:s (T)")."] ".$errorMessage."\r\n"; // save to the error log error_log($errorMessage, 3, ERROR_LOG."ErrorLog".date("j-M-Y").".log"); } } //ends the class over here ?> Receptions/Weddings Salsa Music in the Twin Cities | Twincitiesfun.com



Receptions/Weddings Salsa Music in the Twin Cities

3 Results, Scroll down to view