-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 = '[email protected]';

$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.

11
  • check your initialization of $mysqli. add your code of initialization of $mysqli. Commented Jan 15, 2014 at 12:25
  • your Mysqli Connections are OK? Commented Jan 15, 2014 at 12:25
  • Oh yes. I initialize mysqli before and after this code run. Commented Jan 15, 2014 at 12:30
  • the $mysqli initializes in a separated file wich starts the mysql connection and it runs fine with other querys including this one Commented Jan 15, 2014 at 12:32
  • Thread updated so you can see the mysqli connection Commented Jan 15, 2014 at 12:36

1 Answer 1

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 =?");
Sign up to request clarification or add additional context in comments.

2 Comments

Still not working.. Is there anyway to echo the query I'm trying to send? Thank you.
@B1GB0Y: after binding : $ins->error ? give me the error

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.