MySQL-Link as instance variable

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
walle
Forum Newbie
Posts: 2
Joined: Thu Sep 09, 2010 3:28 am

MySQL-Link as instance variable

Post by walle »

Hey,

I'm trying to save a MySQL-Link source as an instance variable in my query class.
The problem is that MySQL sees it as an invalid MySQL-Link (supplied argument is not a valid MySQL-Link resource).
What I'm I doing wrong?

//Walle

Code: Select all

private $connection;
//Construct
public function __construct(&$connection)
{
  $this->connection = $connection; 
}

//Where the error occurs
public function exe_query($sql)
 {
  $result = mysql_query($sql, $this->connection);
  if(!$result) {
  throw new Exception(mysql_error());
 }
 return $result;
}
walle
Forum Newbie
Posts: 2
Joined: Thu Sep 09, 2010 3:28 am

Re: MySQL-Link as instance variable

Post by walle »

Problem solved
Post Reply