Jump to content

Recommended Posts

I have a 'product' object defined. In it there is a property called 'oursql' which I make the PEAR sql connection in. I am going to be calling several methods in this object over and over and I'd like to be able to use the same connection.

 

When I instantiate the product object I create an sql object connection in the __construct() method.

 

product constructor:

	function __construct()
{
	$oursql = new sqlclass();
}

 

sqlclass in my sql data tier class. It's constructor makes the connection.

 

after I instantiate my product object I make a call to do a query. However that lookup is failiing telling me that $oursql is not defined.

 

		$this->oursql->query($query,SQL_INIT);

 

Fatal error: Call to a member function query() on a non-object in ...

 

Can someone please tell me what I am doing wrong ? I'll need to make thousands of calls, and I'd like to be able to use that connection that was established when I created the product object for every query.

 

Thanks,

Patrick

 

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.