Jump to content

function call error... (using PEAR MDB2 library)


qmqmqm

Recommended Posts

Ihave the following code:

 

	function query($connection, $query_string){
	$result = $connection->query();
	if (MDB2::isError($result)){
		die("Could not query the database:<br />".$query_string." ".MDB2::errorMessage($result));
	}

	return $result;
}

$query = "SELECT * FROM profiles WHERE id=$id";
$result = query($connection, $query);

I get the following error:

"Warning: Missing argument 1 for MDB2_Driver_Common::query(), called in..."

 

 

If I query directly:

	$query = "SELECT * FROM profiles WHERE id=$id";
$result = $connection->query($query);
if (MDB2::isError($result)){
	die("Could not query the database:<br />".$query." ".MDB2::errorMessage($result));
}

Then there is no error.

 

Does anyone know why this is?

 

Thanks,

 

Tom

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.