[phpMP-Commits] CVS: phpMyPublications/includes/db mysql.php,1.1.1.1,1.2
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2005-02-07 23:26:37
|
Update of /cvsroot/phpmp/phpMyPublications/includes/db In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23037/includes/db Modified Files: mysql.php Log Message: A few additions that weren't in the initial commit. Index: mysql.php =================================================================== RCS file: /cvsroot/phpmp/phpMyPublications/includes/db/mysql.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -r1.1.1.1 -r1.2 *** mysql.php 7 Feb 2005 23:13:39 -0000 1.1.1.1 --- mysql.php 7 Feb 2005 23:26:29 -0000 1.2 *************** *** 11,28 **** // $Id$ // ! // FILE NAME: mysql.php ! // START DATE: Feb 7, 2005 // // --------------------------------------------------------------- ! if(! defined('IN_PHPMP') ) { - die('Hacking attempt.'); - } ! include($phpmp_root_path . 'config.php'); ! include($phpmp_root_path . 'includes/db/' . $db_type . '.php'); ! $db = new sql_db(); ?> \ No newline at end of file --- 11,78 ---- // $Id$ // ! // FILE NAME : mysql.php ! // START DATE : Feb 7, 2005 ! // ! // // // --------------------------------------------------------------- ! class db { ! var $connection_id; ! var $result; ! var $num_queries = 0; ! var $queries = array(); ! ! connect($host, $user, $password, $database, $port = false) ! { ! $this->host = $host; ! $this->user = $user; ! $this->password = $password; ! $this->database = $database; ! $this-port = $port; ! ! $this->connection_id = @mysql_connect($host . (($port) ? ':' . $port : ''), $user, $password); ! ! if($this->connection_id && ($database != '')) ! { ! if(@mysql_select_db($database)) ! { ! return $this->connection_id; ! } ! } ! ! return error(true); ! } ! ! query($sql) ! { ! $query = @mysql_query($sql, $this->connection_id); ! if($query != 0) ! { ! $this->num_queries++; ! $queries[] = $query; ! return $query; ! } ! ! return false; ! } ! ! error($fatal = false, $sql = '') ! { ! if($fatal) ! { ! $error = 'A fatal error occurred while accessing the database.<br /><br /><b>ERROR:</b> ' . @mysql_error; ! $error .= ($sql != '') ? '<br /><br />b>SQL:</b> ' . $sql : ''; ! ! trigger_error($error); ! } ! ! return array('error' => @mysql_error(), 'code' => @mysql_errno()); ! } ! ! } ?> \ No newline at end of file |