12-15-2007, 08:57 PM
|
#1 (permalink)
|
|
The Acquainted
Join Date: Oct 2007
Location: florida
Posts: 110
Thanks: 36
|
Runtime Error
I was working on an OOP user tutorial and I've fixed everything so far except this:
Quote:
Runtime Notice on line 19,
Redefining already defined constructor for class mysql, in /xxx/xxx/xxx/classes/mysql.php
|
I'm thinking it's due to a class in my user.php class file that extends the SQL class defined in mysql.php, that also contains a __construct method.
First part of User class from user.php:
PHP Code:
class User extends mysql { var $mysql;
function __construct( ) { $this->mysql = new mysql(); foreach($_POST as $key => $val) { $_POST[$key] = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); $$key = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); } foreach($_GET as $key => $val) { $_GET[$key] = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); $$key = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); } foreach($_SESSION as $key => $val) { $_SESSION[$key] = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); $$key = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); } foreach($_COOKIE as $key => $val) { $_COOKIE[$key] = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); $$key = stripslashes(strip_tags(htmlspecialchars($val, ENT_QUOTES))); } }
The first part of the code from the mysql class in mysql.php:
PHP Code:
class mysql { var $MYSQL_user = DBUSER; var $MYSQL_pass = DBPASS; var $MYSQL_host = DBHOST; var $MYSQL_db = DB; var $connect; var $get_db;
function __construct() { $this->Connect(); }
function mysql() { $this->Connect(); }
// Both of the functions above both call to a function called 'Connect', which is below.
function Connect( ) {
$this->connect = mysql_connect($this->MYSQL_host, $this->MYSQL_user, $this->MYSQL_pass)or die(mysql_error( )); $this->get_db = mysql_select_db($this->MYSQL_db)or die(mysql_error().__LINE__.__FILE__);
}
Am I not even close with my assumption with regards to my guess on why this problem is occuring?
=o
thanks
|
|
|
|