[Phpmyadmin-devel] Re: about mysql.user

Rabus rabus at bugfixes.info
Fri Aug 9 10:17:05 CEST 2002


----- Original Message -----
From: "Marc Delisle" <DelislMa at CollegeSherbrooke.qc.ca>


> Robin Johnson wrote:
>
> >On Thu, 8 Aug 2002, Marc Delisle wrote:
> >
> >>can I assume that the password is always the third field of mysql.user?
> >>
> >I don't think so.
> >
> >Why not just specify the fields you want, in the order you want in your
> >query?
> >
> Because the goal is to find if the name of the password field in
mysql.user
> is Password or password, and I wanted to avoid doing a loop for each of
the
> fields, looking for "assword".

What about this:

$res = PMA_mysql_query($sql_query, $dbh);
$row = mysql_fetch_array($res, MYSQL_ASSOC);
if (isset($row['Password'])) {
    $pw_key = 'Password';
} else if (isset($row['password'])) {
    $pw_key = 'password';
} else {
    $pw_key = FALSE;
}

$pw_key should now contain the correct column name for the password field or
FALSE is there is neither a "Password" nor a "password" field.
Regards,

Alexander






More information about the Developers mailing list