Thanks!

Can you also please tell me which variable stores the name for currently used "phpmyadmin" database? 

--------------------------------------------------
Best regards,
Zeeshan Mughal
Email:  zeeshanmughal@ieee.org
Web:  http://www.zixan.info


On Wed, Jul 15, 2009 at 3:43 AM, Michal Čihař <michal@cihar.com> wrote:
Hi

Dne Wed, 15 Jul 2009 01:45:36 -0400
Zeeshan Mughal <zeeshanmughal@ieee.org> napsal(a):

> Hi, I am using the following code to extract currently logged user name from
> PMA_DBI_fetch_value('SELECT USER();')
>
> //        $userAndHost = PMA_DBI_fetch_value('SELECT USER();');
> //        $userAndHost = str_split($userAndHost);
> //        while ($i=0 < count($userAndHost)-1) {
> //            $username += $userAndHost[$i];
> //            $i++;
> //            if ($userAndHost[$i] == "@") {
> //                break;
> //            }

Going chars one by one is not a good idea. How about just explode('@',
$userAndHost)[0]?

But anyway current user is available as
$GLOBALS['cfg']['Server']['user'] without need for any parsing and
querying MySQL.

--
       Michal Čihař | http://cihar.com | http://phpmyadmin.cz

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Phpmyadmin-devel mailing list
Phpmyadmin-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel