Update Array

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";
			$arr = array(":admin" => 1);
			$this->database->DBSet($arr,'users',$whr = 'WHERE username = '.$add);
			$this->view->msg = "Admin Rights Added";
			$this->view->err = true;

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.

I’ve not worked with constructor functions so I may be way off, but that double = = sign in the $whr line just doesn’t look right to me. Seems like you’d want to just define the WHERE and VALUES separate.

$whr = "WHERE username = :username";	
$cnd = array(":username" => $add);

Sure this would mean adding that extra argument to the function but it make more sense to me anyway. Hey, but this whole process looks a little foreign to me.