I’m trying to make it so when an admin types in a username they can upgrade their account to an admin. But when I do that it says that its been upgraded but in reality it isn’t.
Here is the code:
function AddAdmin(){
$this->view->url = $this->config->url;
$this->view->ID = get_class($this);
$this->view->Title = "iOwn > Admin > Edit Admin";
$add = isset($_POST['add_username']) ? $_POST['add_username'] : '';
$this->view->msg = "";
$this->view->err = false;
$sql = "SELECT * FROM users WHERE username = :username ";
$arr = array(":username" => $add);
$ctr = $this->database->DBCtr($sql,$arr);
$this->view->admin = $ctr[0]['admin'];
if($add == ""){
$this->view->msg = "You must enter a username";
}elseif($this->view->admin == 1){
$this->view->msg = "This user is already an Admin";
}elseif($ctr <= 0){
$this->view->msg = "Users is Not Found";
}else{
$arr = array(":admin" => 1);
$this->database->DBSet($arr,'users',$whr = 'WHERE username = '.$add);
$this->view->msg = "Admin Rights Added";
$this->view->err = true;
}
$this->view->render('Admin/AddAdmin');
}
I have also tried to put
$this->view->yes = 1;
up above
$this->view->msg = "";
and then instead of
$arr = array(":admin" => 1);
I tried
$arr = array(":admin" => $this->view->yes);
And it still says that the admin rights have been added but in reality they haven’t been.
Admin is a column in my database.