I've got everything working for pset7 except for buy.php, it works fine other than allowing users to buy shares they can't afford. I can't figure out why this bit of code isn't working:
// get users cash
$cash = query("SELECT cash FROM users WHERE id = ?", $_SESSION["id"]);
// calculate value
$value = $stock["price"] * $_POST["shares"];
// if cash less than value
if ($cash < $value)
{
apologize("Insufficient funds.");
}