I'm using MySQLi prepare statements in php. The exact same code works on my local machine, but fails on the online server (it doesn't insert into the database table). I'm a server noob, so I don't know if there's a setting I need to configure or not. The else
branch in the following code I got from another SO question, but it's not returning any errors. I have the following at the top of my php file:
error_reporting(E_ALL);
ini_set('display_errors', 1);
edit to add: $conn->prepare(....)
is returning false
$conn = new mysqli($SERVER, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
if ($stmt = $conn->prepare("INSERT INTO tblTasks (taskID, blockNumber, transactionID, tasker, permlink, title, price, location, currency, tags, `status` ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")) {
$stmt->bind_param("sssssssssss", $taskID, $blockNumber, $transactionID, $tasker, $permlink, $taskTitle, $taskPrice, $location, $currency, $tags, $status);
if(!$stmt->execute()) {
die("Insertion failed.");
}
$stmt->close();
} else {
$error = $conn->errno . ' ' . $conn->error;
echo $error;
}