So... Star Wars code again...
I have some code that I want to change a boolean value in a MySQL database from true to false, based on a button push. The specific code included relates to people who have stated that their chosen character uses a lightsaber. I want to apply a flag to a view called "gameview" whose rows will be counted until there is one character left. If there's a false value in the flag column, then it is not counted.
I have created a number of classes, methods and controllers as well as a view. The pages all display as they should. However, when the relevant button is pressed, the code is not changing the flags as expected. I am fairly sure that the MySQL code is good, so it is something to do with the PHP code. The method is in a class called gameview.class.php
Class Codes:
Public function iterateGameView($id)
    {   $changeFlag = "UPDATE gameview SET flag :flag WHERE id = :id";
        $stmt = $this->Conn->prepare($changeFlag);
        $stmt->execute(array([':flag' => false, ':id' => [$id]]));
    }
Lightsaber Class Code
public function noLightsaberUsed()
    {
        $query = "select * from person, weapon, person_weapon 
WHERE flag = 0 AND person.id = person_weapon.person_id AND person_weapon.weapon_id = weapon.id and weapon.name != 'Lightsaber'
AND person.name NOT IN (select person.name from person, weapon, person_weapon WHERE person.id = person_weapon.person_id
AND person_weapon.weapon_id = weapon.id and weapon.name = 'Lightsaber')";
        $stmt = $this->Conn->prepare($query);
        $stmt->execute(array());
        return $stmt->fetchAll(PDO::FETCH_ASSOC);
    }
Lightsaber controller
<?php
$lightsaber = new lightsaber($Conn);
$gameView = new gameView($Conn);
if ($_POST) {
    if ($_POST['lightsaber'] = 1) {
        $lightsabers = $lightsaber->noLightsaberUsed();
        $smarty->assign('lightsabers_used', $lightsabers);
        $lightsabersFlag = array($lightsabers, 'id', 'flag');
        for ($i = 0; $i <= count($lightsabersFlag); $i++) {
            $gameView->iterateGameView($lightsabersFlag[$i]);
        }
    } elseif ($_POST['lightsaber'] = 2) {
        $lightsabers = $lightsaber->lightsaberUsed();
        $smarty->assign('lightsabers_used', $lightsabers);
        $lightsabersFlag = array($lightsabers, 'id', 'flag');
        for ($i = 0; $i <= count($lightsabersFlag); $i++) {
            $gameView->iterateGameView($lightsabersFlag[$i]);
        }
    }
    $count = $gameView->countGameView();
    if ($count > 1) {
        header("Location: index.php?p=rebel");
    } elseif ($count < 1) {
        header("Location: index.php?p=fail");
    } else {
        header("Location: index.php?p=gameview");
    }
}
?>
The bit that I believe that I am stuck on is the iterateGameView method. I'm a relative novice with PHP and MySQL and this is the first time I've attempted a prepared statement.
