query($sql) as $row) { $ammount = $row['amount'] + 1; } if ($ammount >=11){ header("location: https://www.google.co.uk"); exit; } $dbh = null; } catch(PDOException $e) { echo $e->getMessage(); }