Phill Pafford
Phill Pafford

Reputation: 85378

Is there a way to tell the differences of a PostgreSQL, MySQL or MSSQL connection resource?

If I have $dbConn (a database connection) and I don't know if it's MySQL, MSSQL or PostgreSQL can I tell what type of connection it is?

Just wanted to know if there is a method to return the connection type of a resource id?

EDIT: Sorry, yes PHP added the tag

Upvotes: 1

Views: 131

Answers (1)

AndreKR
AndreKR

Reputation: 33697

$connection = mysql_connect(...); 

$is_mysql = (get_resource_type($connection) == 'mysql link');
$is_ibase = (get_resource_type($connection) == 'Firebird/InterBase link'); // *

var_dump($is_mysql); // -> true

// * supposed to be "interbase link" but isn't any longer

Upvotes: 1

Related Questions