私はすべての人がそれを機能させるように私に言ったのですが、エラーも挿入された行もありません:
何か案が?
private $db;
// Constructor - open DB connection
function __construct()
{
$this->db = new mysqli('localhost', 'root', '', 'sampleinyoudb');
$this->db->autocommit(FALSE);
if (mysqli_connect_errno())
{
sendResponse(500, "Could not connect to the database!");
exit();
}
}
// Destructor - close DB connection
function __destruct()
{
$this->db->close();
}
...
if($stmt = $this->db->prepare("INSERT INTO Users (id,email) VALUES (?, ?)"))
{
$test1 = 1; //Empty
$test2 = 'asdasd@gmail.com'; //Empty
$stmt->bind_param("is", $test1, $test2);
$stmt->execute();
if ( false===$stmt )
{
die('execute() failed: ' . htmlspecialchars($mysqli->error));
}
$stmt -> close();
}
else
{
printf("Prepared Statement Error: %s\n", $this->db->error);
}
echo 'Any Errors: '.$this->db->error.PHP_EOL;