Selecting two field in MySQL with PHP

Posted by Crays on Stack Overflow See other posts from Stack Overflow or by Crays
Published on 2010-05-03T12:52:43Z Indexed on 2010/05/03 12:58 UTC
Read the original article Hit count: 234

Filed under:
|

Hi guys, i'm relatively new to php and mysql and would like to know how to select two value in mysql with php.

What i have is

$query = sprintf("SELECT COUNT(id) FROM table WHERE UPPER(username) = UPPER('%s') AND password='%s'"...

in this case, i'm only selecting and count if the id exist and i use

list($count) = mysql_fetch_row($result);
        if($count == 1)

and by using cookies, i would like to retrieve two value from the database, namely user (the user's name) and power (which has value of 1,2 or 3, indicating the menu they would be able to see) basically it is to differentiate if you're admin or normal user, but i wonder if i could do

SELECT COUNT(id) AND power FROM table WHERE ...

is this possible? or is there any other way?

Please guide me, thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql