I have been working a long time in buy.php and everything works but if I buy the same stock (AAPL) twice it insert a new row into table despite they have de same id, and symbol.
//Pass it to capital leters
$simbolo=strtoupper($_POST["symbol"]);
query("INSERT INTO `Tabla para quotes` (id, symbol, shares) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE shares = shares + VALUES(shares)", $_SESSION["id"],$simbolo, $_POST["shares"]);
//New chash
query("UPDATE users SET cash = cash - ? WHERE `id`=?",$costo,$_SESSION["id"]);
//redirect to index
redirect("index.php");
}
Please help!