--- db.php.orig	2004-12-30 04:23:04.798019911 -0600
+++ db-mysqli.php	2004-12-30 04:50:45.208252601 -0600
@@ -25,7 +25,7 @@
 	//	DB Constructor - connects to the server and selects a database
 
 	function bbdb($dbuser, $dbpassword, $dbname, $dbhost) {
-		$this->dbh = @mysql_connect($dbhost, $dbuser, $dbpassword);
+		$this->dbh = @mysqli_connect($dbhost, $dbuser, $dbpassword);
 		if (!$this->dbh) {
 			$this->bail("
 <h1>Error establishing a database connection</h1>
@@ -45,7 +45,7 @@
 	//	Select a DB (if another one needs to be selected)
 
 	function select($db) {
-		if (!@mysql_select_db($db, $this->dbh)) {
+		if (!@mysqli_select_db($this->dbh, $db)) {
 			$this->bail("
 <h1>Can&#8217;t select database</h1>
 <p>We were able to connect to the database server (which means your username and password is okay) but not able to select the <code>$db</code> database.</p>
@@ -69,7 +69,7 @@
 
 	function print_error($str = '') {
 		global $EZSQL_ERROR;
-		if (!$str) $str = mysql_error();
+		if (!$str) $str = mysqli_error($this->dbh);
 		$EZSQL_ERROR[] = 
 		array ('query' => $this->last_query, 'error_str' => $str);
 
@@ -119,43 +119,43 @@
 		// Keep track of the last query for debug..
 		$this->last_query = $query;
 
-		// Perform the query via std mysql_query function..
+		// Perform the query via std mysqli_query function..
 		if (SAVEQUERIES)
 			$this->timer_start();
 		
-		$this->result = @mysql_query($query, $this->dbh);
+		$this->result = @mysqli_query($this->dbh, $query);
 		++$this->num_queries;
 
 		if (SAVEQUERIES)
 			$this->queries[] = array( $query, $this->bb_timer_stop() );
 
 		// If there is an error then take note of it..
-		if ( mysql_error() ) {
+		if ( mysqli_error($this->dbh) ) {
 			$this->print_error();
 			return false;
 		}
 
 		if ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) {
-			$this->rows_affected = mysql_affected_rows();
+			$this->rows_affected = mysqli_affected_rows($this->dbh);
 			// Take note of the insert_id
 			if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
-				$this->insert_id = mysql_insert_id($this->dbh);	
+				$this->insert_id = mysqli_insert_id($this->dbh);
 			}
 			// Return number of rows affected
 			$return_val = $this->rows_affected;
 		} else {
 			$i = 0;
-			while ($i < @mysql_num_fields($this->result)) {
-				$this->col_info[$i] = @mysql_fetch_field($this->result);
+			while ($i < @mysqli_num_fields($this->result)) {
+				$this->col_info[$i] = @mysqli_fetch_field($this->result);
 				$i++;
 			}
 			$num_rows = 0;
-			while ( $row = @mysql_fetch_object($this->result) ) {
+			while ( $row = @mysqli_fetch_object($this->result) ) {
 				$this->last_result[$num_rows] = $row;
 				$num_rows++;
 			}
 
-			@mysql_free_result($this->result);
+			@mysqli_free_result($this->result);
 
 			// Log number of rows the query returned
 			$this->num_rows = $num_rows;

