Hi.
I am having a dickens of a time with my code. I have watered it down, to just the concept now. Can anyone out there please help. Thanks in advance. Kyle Corey
This first Code is my Class page. it is saved as con_test.php
Code: Select all
<?php
class Test {
function __construct(){
$this->dbConnect = @new mysqli("localhost", "root", "******"); //not the actual password
if (mysqli_connect_errno()) {
die("<p>Unable to connect to the database server!!</p>");
} else echo "<p>Connected to database server</p>";
}
function __destruct() {
}
public function setDatabase($database) {
$this->database = $database;
$this->dbConnect->query($database) or die("<p>Unable to select the database!!");
}
}
?>Code: Select all
<?php
require_once("con_test.php");
session_start();
$test = new Test();
$test->setDatabase('coreyk_bankdb') or die("doh");
?>Cheers Kyle Corey
http://www.kylecorey.ca