Hey,
I'm running this through my index page:
And it returns:PHP Code:<?php
require('library/includes.php');
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', 'on');
try
{
$connection = new mysql('localhost', 'root', '');
$connection->select('cms');
}
catch (Exception $e)
{
echo $e;
}
?>
It's not really telling me anything, or at least I can't decipher it properly.Code:exception 'Exception' in C:\Users\9three\Desktop\Server\htdocs\gb\library\mysql.class.php:29 Stack trace: #0 C:\Users\9three\Desktop\Server\htdocs\gb\index.php(10): mysql->select('cms') #1 {main}
mysql.class.php:
What I'm trying to do is connect to whatever database was provided in this object $connection->select()PHP Code:public function __construct($host = '', $username = '', $password = '')
{
$this->host = $host;
$this->username = $username;
$this->password = $password;
$this->connect();
}
public function connect()
{
$this->link = mysql_connect($this->host, $this->username, $this->password);
if (!is_resource($this->link))
Throw New Exception(mysql_error());
else
return $this->link;
}
public function select($dbname)
{
$this->select = mysql_select_db($dbname, $this->link);
if (!is_resource($this->select))
Throw New Exception(mysql_error());
else
return $this->select;
}





Bookmarks