fantomel Posted November 7, 2008 Share Posted November 7, 2008 Hello i have a small problem with a mysql class and i can't get it fixed. These are the errors : Warning: Missing argument 1 for MySQL::__construct(), called in C:\webserver\public_html\core\core.php on line 9 and defined in C:\webserver\public_html\classes\mysql.class.php on line 11 Warning: Missing argument 2 for MySQL::__construct(), called in C:\webserver\public_html\core\core.php on line 9 and defined in C:\webserver\public_html\classes\mysql.class.php on line 11 Warning: Missing argument 3 for MySQL::__construct(), called in C:\webserver\public_html\core\core.php on line 9 and defined in C:\webserver\public_html\classes\mysql.class.php on line 11 Warning: Missing argument 4 for MySQL::__construct(), called in C:\webserver\public_html\core\core.php on line 9 and defined in C:\webserver\public_html\classes\mysql.class.php on line 11 Fatal error: Class 'Inter_error' not found in C:\webserver\public_html\classes\mysql.class.php on line 20 my core.php php code: <?php require '../classes/mysql.class.php'; global $db; $db = &new MySQL(localhost, root, root, testing); ?> my mysql class : class MySQL { var $host; var $name; var $pass; var $dba; var $resultLink; private $connection; public function __construct($host, $name, $pass, $dba) { if($host && $name && $pass & $dba) { if(!$this->connection = mysql_connect($host,$name,$pass)) throw new MySQL_error("Database Connection Failed!"); if(!mysql_select_db($dba, $this->connection)) throw new MySQL_error("Database Can't Be Selected"); } else { throw new Inter_error("Method: __construct--Error:Incorect arg(requires \$host, \$name, \$pass, \$dba)!!!!"); } } ?> in mysql i have added only the part where it gives the errors. Please can someone help me ? Quote Link to comment https://forums.phpfreaks.com/topic/131790-mysql-classes-user-systems-errors-include-files/ Share on other sites More sharing options...
Mchl Posted November 7, 2008 Share Posted November 7, 2008 require '../classes/mysql.class.php'; global $db; $db = &new MySQL("localhost", "root", "root", "testing"); BTW: Why use such class? Especially with mysql extension. Try mysqli end extend it. Quote Link to comment https://forums.phpfreaks.com/topic/131790-mysql-classes-user-systems-errors-include-files/#findComment-684615 Share on other sites More sharing options...
JonnoTheDev Posted November 7, 2008 Share Posted November 7, 2008 You are not passing in strings to the constructor $db = &new MySQL(localhost, root, root, testing); Ammend to $db = &new MySQL("localhost", "root", "root", "testing"); Quote Link to comment https://forums.phpfreaks.com/topic/131790-mysql-classes-user-systems-errors-include-files/#findComment-684617 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.