
November 24th, 1999, 05:54 AM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
I am having a few problems with my page.
I have two classes DB_Core and DB_Connect.
I try to create an instance of DB_Core in DB_Connect. I can't seem to create the variable instance after the class header before I start writing the functions.
If I try 'var $db = new DB_Core;'
then I get:
Parse error: parse error in php-class/db-connect.inc on line 10
If I try '$db = new DB_Core;'
then I get
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in php-class/db-connect.inc on line 10
I managed to get it to work within the function but obviously the variable scope is only local to the function and not to the class. If I try and use the global appended to the variable it gives me a Parse Error the same as the first error code above.
This is the general format of DB_Connect
require ("php-class/db-core.inc");
class DB_Connect {
var $conn = 0;
var $stmt = 0;
var $Error = 0;
var $Errno = "";
var $db = new DB_Core;
function DB_Connect($user, $pass) {
$this->conn = $db->connect($user, $pass);
All file names are correct.
Thanks for any help that anyone can give. Any information I have found on PHP Classes has been sketchy but nothing on this sort of problem.
Falcon
|