Update MYSQL Table Data

Asked

Viewed 26 times

0

I can’t accomplish UPDATE of the data from my table.

$id = 7;
$TrocaNome = "Ronaldo";  
$TrocaEmail = "[email protected]";  
$up = "UPDATE usuario SET nome='$TrocaNome', email='$TrocaEmail' WHERE id=$id";  
 var_dump($id,$TrocaNome,$TrocaEmail);  **//verifica se esta recebendo informações  
 passadas.**

if(mysqli_affected_rows($conn) < 1){  
echo "Nenhuma informação foi registrada no sistema.";  
}else{  
    echo"Dados Atualizados copm Sucesso";  
}  
mysqli_close($conn);  

RESULT: int(7) No information was recorded in the system.

1 answer

2


It’s missing running its query:

$id = 7;
$TrocaNome = "Ronaldo";  
$TrocaEmail = "[email protected]";  
$up = "UPDATE usuario SET nome='$TrocaNome', email='$TrocaEmail' WHERE id=$id";  
$exec = mysqli_query($conn, $up);

Useful links

Documentation: mysqli_query

Browser other questions tagged

You are not signed in. Login or sign up in order to post.