
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