-1

I'm facing this problem and I've searching for hours now.. I can't see any problem in this piece of code... What's wrong here?

db.php:

<?php
$mysqli = mysqli_connect('localhost', 'root', '', 'site');
if(mysqli_connect_errno()) 
    {
          echo "Erro BD";
          exit();
    }
?>

update.php:

include 'db.php';

$zzz = '';
$email = 'asdsaf@gmail.com';

$ins = $mysqli->prepare("update USER set cod_valida =? where email =?");
$ins->bind_param('ss', $zzz, $email);

   if ($result = $ins->execute()){

      $ins->free_result();
      echo "It works";
   }
   else
   {
     echo "Error";
   }
$ins->close();
$mysqli->close();

Is there anyway to echo the query I'm trying to send or the mysql error?

Thank you for your help instead of downvote my thread since I already checked everything and found no answer.

B1GB0Y
  • 43
  • 3
  • 12

1 Answers1

0

It seems that you have wrong in your query table name. table name is case sensetive and check your column name with database table.

ref: mysql case sensitive table names in queries

change

$ins = $mysqli->prepare("update USER set cod_valida =? where email =?");

to

$ins = $mysqli->prepare("update user set cod_valida =? where email =?");
Community
  • 1
  • 1
Awlad Liton
  • 9,366
  • 2
  • 27
  • 53