I am experiencing an issue where my PHP code for inserting into a database table is not reflecting changes in the table. I have looked through existing posts and have not found a solution. The previous posts with the same issue usually had glaring issues in the code.
$stmt->execute()
is returning True
. I am committing the transaction as well as closing the statement.
This is happening on MariaDB, version 5.5.5.
The table is simple and only contains 2 columns:
CREATE TABLE gallery (image_type varchar(255), url varchar(800));
My code is:
$conn = new mysqli($servername, $username, $password, $dbname);
$type = 'foo';
$url = 'bar';
$stmt = $conn->prepare("INSERT INTO gallery (image_type, url) VALUES (?, ?)");
$stmt->bind_param('ss', $type, $url);
if ($stmt->execute()) {
$conn->commit();
$stmt->close();
echo "Success!";
} else {
echo "Failure!";
}
If I connect to the database in command line and run an insert statement it works fine, so I know this is an code issue.