For some reason, bind_param()
says it's being called on a non-object, here is my script:
$con = new mysqli("localhost", "root", "", "lesea");
Here's where the query is being called:
var_dump($_POST['title']);
var_dump($_POST['description']);
var_dump($__final_route);
$stmt = $con->prepare("INSERT INTO post(title, content, image) VALUES(?, ?, ?)");
$stmt->bind_param('sss', $_POST['title'], $_POST['description'], $__final_route);
if($stmt->execute()){
echo "Post uploaded successfully!";
} else{
echo "Post not uploaded due to an error, please try again.";
}
var_dump()
provides string for each of the variables held inside the bind_param()
method so I have no idea what is going on. Rookie mistake? It's been a while since I've done any back-end development. Any help would be much appreciated.