Skip to content
This repository has been archived by the owner on Aug 25, 2019. It is now read-only.

Commit

Permalink
cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
dietrichm committed Mar 26, 2005
1 parent 1e250dd commit 721a284
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 28 deletions.
19 changes: 5 additions & 14 deletions sources/db_mysql.php
Expand Up @@ -41,7 +41,7 @@ class db {
// Variables in this class
//
var $connection;
var $queries;
var $queries = array();

//
// Make a connection to the MySQL server
Expand All @@ -61,11 +61,6 @@ function connect($config) {
if ( !(@mysql_select_db($config['dbname'], $this->connection)) )
$functions->usebb_die('General', 'Unable to connect to the database!', __FILE__, __LINE__);

//
// Initialize used queries array
//
$this->queries = array();

}

//
Expand All @@ -75,8 +70,7 @@ function query($query) {

$add_query = preg_replace("/\s+/", ' ', $query);
$this->queries[] = $add_query;
$result = @mysql_query($query, $this->connection);
return $result;
return @mysql_query($query, $this->connection);

}

Expand All @@ -85,8 +79,7 @@ function query($query) {
//
function fetch_result($result) {

$out = mysql_fetch_array($result, MYSQL_ASSOC);
return $out;
return mysql_fetch_array($result, MYSQL_ASSOC);

}

Expand All @@ -95,8 +88,7 @@ function fetch_result($result) {
//
function num_rows($result) {

$out = mysql_num_rows($result);
return $out;
return mysql_num_rows($result);

}

Expand All @@ -105,8 +97,7 @@ function num_rows($result) {
//
function last_id() {

$id = mysql_insert_id($this->connection);
return $id;
return mysql_insert_id($this->connection);

}

Expand Down
19 changes: 5 additions & 14 deletions sources/db_mysqli.php
Expand Up @@ -41,7 +41,7 @@ class db {
// Variables in this class
//
var $connection;
var $queries;
var $queries = array();

//
// Make a connection to the MySQL server
Expand All @@ -61,11 +61,6 @@ function connect($config) {
if ( !(@mysqli_select_db($config['dbname'], $this->connection)) )
$functions->usebb_die('General', 'Unable to connect to the database!', __FILE__, __LINE__);

//
// Initialize used queries array
//
$this->queries = array();

}

//
Expand All @@ -75,8 +70,7 @@ function query($query) {

$add_query = preg_replace("/\s+/", ' ', $query);
$this->queries[] = $add_query;
$result = @mysqli_query($query, $this->connection);
return $result;
return @mysqli_query($query, $this->connection);

}

Expand All @@ -85,8 +79,7 @@ function query($query) {
//
function fetch_result($result) {

$out = mysqli_fetch_array($result, MYSQL_ASSOC);
return $out;
return mysqli_fetch_array($result, MYSQL_ASSOC);

}

Expand All @@ -95,8 +88,7 @@ function fetch_result($result) {
//
function num_rows($result) {

$out = mysqli_num_rows($result);
return $out;
return mysqli_num_rows($result);

}

Expand All @@ -105,8 +97,7 @@ function num_rows($result) {
//
function last_id() {

$id = mysqli_insert_id($this->connection);
return $id;
return mysqli_insert_id($this->connection);

}

Expand Down

0 comments on commit 721a284

Please sign in to comment.