I got a problem in this code in the sql statement ($result). It says that I have a Syntax error on WHERE 'idCartao'='$id'
.
<?php
$db_host = 'localhost';
$db_user = 'root';
$db_pass = '';
$db_database = 'hsa';
$id = $_POST['idTAG'];
try {
$db = new PDO('mysql:host='.$db_host.';dbname='.$db_database, $db_user, $db_pass);
}
catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
$result = $db->prepare("INSERT INTO 'cartao' (horaEntrada,horaSaida) VALUES (CURTIME(),CURTIME()) WHERE 'idCartao'='$id'");
$result->execute();
$db = null;
?>