PHP update SQL Nothing Happens

Asked

Viewed 401 times

0

Great, I need some help. I’m around this problem for almost a day. In this code that updates the data to phpmyadmin does not change anything but also does not give me any error.

<?php
// definições de host, database, usuário e senha
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("navegador", $conn);
//$id = $_GET['id'];

$ID = $_POST["ID"];

$Nome = $_POST["Nome"];

$NumeroBI = $_POST["NumeroBI"]; 

$Morada = $_POST["Morada"]; 

$Telefone = $_POST["Telefone"];

$DataNasc = $_POST["DataNasc"]; 

$Email = $_POST["Email"];

$Password = $_POST["Password"];

$is_admin = $_POST["is_admin"];

$sqlupdate ="update tb_utilizador SET Nome='$Nome', NumeroBI='$NumeroBI', Morada='$Morada', Telefone='$Telefone', DataNasc='$DataNasc',
            Email='$Email', Password='$Password', is_admin='$is_admin' WHERE ID='$ID' " or die (mysql_error());;
  • this command has been discontinued, use mysqli or Pdo

  • Where phpmyadmin comes into doubt?

  • It doesn’t go directly in. It’s just the database I’m using . But I’ve already removed

  • 1

    The database is Mysql if you want to tag it correctly. Phpmyadmin is just a tool for editing.

1 answer

1


replace your code where you have " $sqlupdate" with this one, maybe it works .

$sqlupdate ="update tb_utilizador SET Nome='".$Nome."', NumeroBI='".$NumeroBI."', Morada='".$Morada."', Telefone='".$Telefone."', DataNasc='".$DataNasc."',Email='".$Email."', Password='".$Password."', is_admin='".$is_admin."' WHERE ID='".$ID."' ";
mysql_query($sqlupdate) or die (mysql_error());
  • does not give me any error but also does not update the data

  • puts an echo $sqlupdate; before running mysql_query() you will get the query, try to run the generated query in the database if running, the error is not in the query .

  • If the ID is numerical you do not need the skins. WHERE ID='". $ID."'

Browser other questions tagged

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