0
Hello folks I’m having a problem trying to alter information on a criminal record. The system correctly fetches the ID to be changed and presents me on the screen with the inputs for the changes correctly, but when clicking the "Change" button it returns as if there was no valid ID to change.
This is the validation code:
// pega o ID da URL
$id = isset($_GET['id']) ? (int) $_GET['id'] : null;
// valida o ID
if (empty($id))
{
echo "ID para alteração não definido";
exit;
}
// busca os dados du usuário a ser editado
$PDO = db_connect();
$sql = "SELECT name, birthdate, gender, email, phone, mobile, endereco, numero, bairro, cidade, uf, cep, herois_idherois, entliga, cadvol FROM voluntarios WHERE idvoluntarios = :id";
$stmt = $PDO->prepare($sql);
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
$stmt->execute();
$user = $stmt->fetch(PDO::FETCH_ASSOC);
// se o método fetch() não retornar um array, significa que o ID não corresponde a um usuário válido
if (!is_array($user))
{
echo "Nenhum usuário encontrado";
exit;
}
I try to send POST already tried via GET to try to see what appears in the URL but it just closes and gives me the message "ID for undefined change"; which I reported on echo
Checks if the url is correct:
?id=4159
or&id=4159
. Anything use thevar_export($_GET);
– Valdeir Psr