Sure:
while($row = mysql_fetch_array($result)) {
$usrLevel = $row['userlevel'];
$member = $row['member'];
$pswd = $row['pw'];
}
//end -while loop
Now $usrLevel, $member and $pw are available as variables taken from
this array to use as you please in you php scripts!
Russ
Hi there,
Firstly a big thanks to those who pointed me in the direction of
'PHP-fast and easy web development'. it was/is a great book, and I have
learnt loads on the past week.
Anyhoo...
I have a php page and included the line:
$sql = "SELECT * FROM $table_name
WHERE member = \"$member\" AND pw = \"$pw\" ";
Now I have a third column called 'userlevel'.
I have a cookie that activates on successfully matching the member and
pw fields from a form on the previous page. make sense?
How can I tell the page to use the userlevel colunm too?
Here is the relevent section to my code... can anyone point me in teh
rigth direction please???
============================
$sql = "SELECT * FROM $table_name
WHERE member = \"$member\" AND pw = \"$pw\" ";
$result = mysql_query($sql)
or die ("Can't execute query.");
$num = mysql_numrows($result);
if (($num != 0) && ($userlevel == 1)) {
$cookie_name = "auth";
$cookie_value = "ok";
$cookie_expire = "";
$cookie_domain ="";
setcookie($cookie_name, $cookie_value, $cookie_expire, "/",
$cookie_domain, 0);
$display_block ="
<p><B>Secret area:</B>
<UL>
<LI><a href=\"secreta.php\">secret page a</A>
<LI><a href=\"secretb.php\">secret page b</A>
<LI><a href=\"secretc.php\">secret page c</A>
<LI><a href=\"secretd.php\">secret page d</A>
<LI><a href=\"secreteb.php\">secret page e</A>
</UL>
";
} else {
header("Location: http://www.mypage.com");
exit;
}
#-------------------------------------------------------#
"Believe nothing - consider everything"
Russ Michell
Anglia Polytechnic University Webteam
http://gertrude.sipu.anglia.ac.uk/webteam
[EMAIL PROTECTED]
+44 (0)1223 363271 ext 2331
www.theruss.com
#-------------------------------------------------------#
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]