I have some code to do a simple mysqli procedural INSERT INTO my DB. It looks something like this:
$conn2 = mysqli_connect($servername, $username, $password, $dbname_name);
// Check connection
if (!$conn2) {
die("Connection failed: " . mysqli_connect_error());
}
// prepare and bind
$stmt2 = $conn2->prepare("INSERT INTO db_name (resource_owner, resource_title, resource_text_intro, resource_active) VALUES (?, ?, ?, ?)");
$stmt2->bind_param("issi", $resource_owner, $resource_title, $introduction, $resource_active);
// set parameters and execute
$resource_title = $_POST['resource_title'];
$introduction = $_POST['introduction'];
$resource_active = 0;
$stmt2->execute();
For some reason that I cannot see, this is not inserting into the DB, nor am I getting any error messages. My form simply loops back to the form page (I have it set to redirect to a new page after an insert). I have verified that the $_POST['submit'] is in fact working, so this section of the script is not being skipped over.
Any thoughts?