Q:

Query is setting column value to 0 when it should be to 10

I'm creating a lobby system and I'm making it so that it will get the playercount and add one to it, and if it is 10, it will do a different query rather than the normal one. The issue is, that I'm setting one of the values to 10 and its putting it to 0 and not finishing the other part of the query.
Code:
    $new_playercount = $match_playercount + 1;
    if($new_playercount == 10) {
        $query = "UPDATE queue SET match_playercount='".$new_playercount."' AND match_admin_needed='1' WHERE match_id='".$match_id."'";
        try {
            $stmt = $dbConnect->prepare($query);
            $result = $stmt->execute();
        }
        catch(PDOException $ex) {
            die();
        }
        header('Location: view-lobby/index.php?match_id='.$match_id);
        die();
    } else {
        $query = "UPDATE queue SET match_playercount='".$new_playercount."' WHERE match_id='".$match_id."'";
        try {
            $stmt = $dbConnect->prepare($query);
            $result = $stmt->execute();
        }
        catch(PDOException $ex) {
            die();
        }
        header('Location: view-lobby/index.php?match_id='.$match_id);
        die();
    }

Tell me if you need something else and I will try to provide it. But I tested it by setting the playercount to 9, and then joining the lobby which will add 1, and it should be set to 10 and match_admin_needed set to 1, but it doesn't do either, and it actually resets the playercount to 0...

A:

Because your first query is incorrect.
UPDATE queue SET match_playercount='".$new_playercount."' AND match_admin...
                                                          ^

If you update 2 columns you have to use a comma(,) between them, not AND which results in a comparison.
When you use  AND it compares the two sides and then returns a boolean result which is then getting stored as 0 or 1, instead of updating your 2 columns.

