PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 24th, 1999, 05:54 AM
falcon
Guest
Dev Shed Newbie (0 - 499 posts)
 
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP Class Variables

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap