Hello, I have the following php code
function updateRecord($email, $score){
$sql = "UPDATE record set record = $score where email = '$email' ";
$banco-> initBD()->exec($sql); //O Log indica o erro nessa linha
if($banco->rowCount()>0){
$obj = array("resposta"=>1);
}else{
$obj = array("resposta"=>2);
}
$array[] = $obj;
// json_encode($array);
echo stripslashes( json_encode($array));
}
function initBD(){
//servidor online
$opcoes = array(PDO::MYSQL_ATTR_INIT_COMMAND=> 'SET NAMES UTF8');
return (new \PDO ('mysql:host=localhost;port=80;dbname=yyyyyy; charset=utf8', 'login', 'senha', $opcoes));
}
I do not know if this is enough to answer the question, but I'm waiting for feedback.