How do I set a variable in mysql database to equal txt so for example I have a table user-status which has values of 0 , 1, 2 or 3. I want a drop down to say if user_status = 3 display admin if user_status = 0 display no status in the drop down and so on. Here is my code
<?php
$SESSION_ID = ($_POST['SESS_MEMBER_ID']);
require_once('auth.php');
require_once('config.php');
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if(!$db) {
die("Unable to select database");
}
//Create query
$sqlid= $_SESSION['SESS_MEMBER_ID'];
$my_rows;
$sql = mysql_query("SELECT * FROM members order by member_id");
if(!$sql) {
die("Unable to select query");
}
while($row = mysql_fetch_array($sql,MYSQL_ASSOC)){
$my_rows = $my_rows . '<br><br />
Member ID: ' . '<a href="?edit='.$row['member_id'] .'">' . $row['member_id'] . '</a>' . '<br />
Name:<b> ' . $row['firstname'] . ' ' . $row['lastname'] . '</b><br />
Login: ' . $row['login'] . ' <br />
Password: ' . $row['passwd'] . ' <br />
Member Status: ' . $row['user_status'] . ' <br />';
$id = $row['member_id'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Member Admin</title>
<link href="loginmodule.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Welcome <?php echo $_SESSION['SESS_FIRST_NAME'];?> <?php echo $_SESSION['SESS_LAST_NAME'];?>
</h1>
<a href="member-profile.php">My Profile</a> | <a href="logout.php">Logout</a>
<p><br /></p>
<p>Current List of members</p>
<p>Anyone with a status of Admin can see this Page</p>
<?php echo $my_rows ?>
</p>
</body>
</html>