How to determine current MySQL link identifier?
| From: | Paul DuBois | Date: | Tue, 03 Oct 2000 01:36:27 +0000 |
| Subject: | How to determine current MySQL link identifier? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-3242@lists.php.net to get a copy of this message | ||
Is there a function that returns the current MySQL link identifier?
Many of the PHP MySQL functions allow you to leave out the link
identifier parameter, in which case they use the default (current)
connection.
If I write a function, what's the best way to emulate this behavior?
I guess one way would be to put every MySQL call inside the function
in an if-statement. For example:
function do_query ($query, $link_id = some_illegal_value)
{
if ($link_id != some_illegal_value)
$result = mysql_query ($query, $link_id)
else
$result = mysql_query ($query)
}
But that seems silly and inefficient.
Or is there some default value I can use for $link_id that I can
pass to the MySQL functions to cause them to use the default connection?
--
Paul DuBois, paul@snake.net