So I am working on an admin
panel feature in PHP 5.6
and whenever I try to switch a user to Admin it will set them to Builder I have no idea where or what I am doing wrong
Here is the code
this is updateusera.php
<?php include 'core/init.php';
$id = $_GET['id'];
$type = $_GET['type'];
if($type == 'admin'){
mysql_query("UPDATE `users` SET `type` = 'user' WHERE `user_id` = '$id'");
header('location: changeusers.php');
} else if($type =='user'){
mysql_query("UPDATE `users` SET `type` = 'admin' WHERE `user_id` = '$id'");
header('location: changeusers.php');
}
//=========================================================================
if($type == 'moderator'){
mysql_query("UPDATE `users` SET `type` = 'user' WHERE `user_id` = '$id'");
header('location: changeusers.php');
} else if($type =='user'){
mysql_query("UPDATE `users` SET `type` = 'moderator' WHERE `user_id` = '$id'");
header('location: changeusers.php');
}
//=========================================================================
if($type == 'builder'){
mysql_query("UPDATE `users` SET `type` = 'user' WHERE `user_id` = '$id'");
header('location: changeusers.php');
} else if($type =='user'){
mysql_query("UPDATE `users` SET `type` = 'builder' WHERE `user_id` = '$id'");
header('location: changeusers.php');
}
?>
this is the changeusers.php file
for some reason it would not let me put both of my codes in here P.S I am new to Stackoverflow so i'm still getting use to all this
if anyone has an idea I would love to hear it
Thanks!