I had the following .php file running asynchronously through AJAX from my main page that was supposed to submit comments:
<?php
session_start();
include "dxbase.php";
$conn = new mysqli($servername, $username, $password, $dbname);
$comment = "practice";
$prid = 2;
if(isset($_SESSION['user'])){
$usera = $_SESSION['user'];
$stmt = $conn->prepare("INSERT INTO reviews (prid, content, username) VALUES (?, ?, ?)");
$stmt->bind_param("sss", $prid, $comment, $usera);
$stmt->execute();
echo "Review submitted!";
$stmt->close();
} else {
echo "Oops! You need to be signed in to review products!";
}
$conn->close();
?>
When I ran it, it echoed back that it had submitted a comment but when I checked my database it wasn't there: DB
Why isn't it inserting?!