Jump to content

[SOLVED] Trying to use the same sql connection


patrick24601

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

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.