Re: Getting database name from link identifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 25, 2014 at 4:41 PM, Jim Lucas <lists@xxxxxxxxx> wrote:
> On 02/25/2014 01:28 PM, Larry Martell wrote:
>>
>> Is there any way to find out what database I am connected to from a
>> link identifier?
>>
>> I have some code this does this:
>>
>> @ $db = mysql_pconnect($dbserver, $dbuser, $dbpass);
>> @ mysql_select_db($dbname, $db);
>>
>> I know at the time this is executed $dbname is what I want it to be.
>> But later on when I pull data using $db, I get data from a different
>> database. If I try to echo $db at the time of the query I get
>> "Resource id #5". Can I get the database name from $db?
>>
>
> Execute the query "SHOW DATABASE();"  You should get one row back that
> contains the name of the database you are currently "using".

I get a sql syntax error on that.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux