php - prepared statement not executing but msqli_stmt_execute returning true -


i have insert query below , checking if insert successful using: mysqli_stmt_execute. query not executing values not being entered db. however, getting if condition. cannot understand this. have wrapped stmt_prepare in if condition , returning true tht preparing successfully. did same bind statement , have on final execute statement. return true query not executing. structure of table correct. preformed insert in phpmyadmin , pasted generated query addtoken variable.

    $con = 'my login credentials'     $stmt = mysqli_stmt_init($con);     $addtoken = "insert `auth`  values ('',?, ?)";      mysqli_stmt_prepare($stmt, $addtoken);      mysqli_stmt_bind_param($stmt, "si", $token, $id);      if (mysqli_stmt_execute($stmt)){         $message2 = "here";         // worked     }     else{         //didn't work         $message2 = "here 2";     }     echo $message2; 

edit have no idea problem deleted auth table , recreated , worked?

you need not have empty strings in values()in insert query, since inserting 2 values may better specify column names if know

$addtoken = "insert `auth` (column1, column2) values (?, ?)"; 

Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -