Updating Records
Posted: Mon Jul 13, 2015 7:13 pm
Hello,
I'm having problems with updating my records when i change from admin to member can anyone help me please this is my admin page code
I'm having problems with updating my records when i change from admin to member can anyone help me please this is my admin page code
Code: Select all
This is the options page code<?php
if (isset($_GET['test']) && !empty($_GET['test'])){
?>
<table>
<tr>
<td width='150px'>Users</td><td>Settings</td></tr>
<td width='150px'></td><td></td></tr>
<?php
$list_query2 = mysql_query("SELECT id, username, user_level FROM users");
while($run_list2 = mysql_fetch_array($list_query2)){
$u_id1 = $run_list2['id'];
$u_username1 = $run_list2['username'];
$u_level1 = $run_list2['user_level'];
?>
<tr><td><?php echo $u_username1 ?></td><td>
<?php
if($u_level1 == '1'){
echo "<a href='options.php?u_id1=$u_id1&test=$u_level1'>Admin</a>";
} else {
echo "<a href='options.php?u_id1=$u_id1&test=$u_level1'>Member</a>";
}
?>
</td></tr>
<?php
}
?>
</table>
<?php
} else {
echo "";
}
?>
Code: Select all
<?php
include 'connection/connect.php';
include 'functions/functions.php';
$u_id1 = $_GET['u_id'];
$u_level1 = $_GET['user_level'];
if ($u_level1 == '1'){
mysql_query("UPDATE `users` SET `user_level`='2' WHERE `id`='$u_id1'");
echo "<meta http-equiv='refresh' content='0;url=admin.php?test=user'>";
} else if($u_level1 == '2'){
mysql_query("UPDATE `users` SET `user_level`='1' WHERE `id`='$u_id1'");
echo "<meta http-equiv='refresh' content='0;url=admin.php?test=user'>";
}
?>