I have the following PHP code, and when I execute it, affected_rows returns -1, but when I run a select in HeidiSQL, the data is in the table. Why does this happen?
$id = filter_input(INPUT_POST, 'id', FILTER_VALIDATE_INT);
$estatus = filter_input(INPUT_POST, 'estatus');
$larga = filter_input(INPUT_POST, 'larga');
$corta = filter_input(INPUT_POST, 'corta');
$fecha = filter_input(INPUT_POST, 'fecha');
$usuario = $_SESSION['id'];
$query = 'INSERT INTO tarea(oportunidad_id, estatus, usuarioId, tareaTarea, fechaLimite, tareaCorta)'
. 'VALUES(' . $id . ', "' . utf8_decode($estatus) . '", ' . $usuario . ', "' . $larga . '", "' . $fecha .
'", "' . $corta . '")';
$con->query($query) or exit("Error: " . $con->errno . ": " . $con->error);
if ($con->affected_rows > 0) {
echo 'Tarea agregada';
} else {
exit($con->mensaje_error());
}