Selecting two field in MySQL with PHP
- by Crays
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.