I have been stuck on this problem for a few days now and can't seems to work it out! I am trying to delete a blog entry where the title is posted to the form through sql and have tried 2 ways, both fail and give the following outputs/errors:
Test Inputstring(10) "Test Input" Fatal error: Call to a member function bind_param() on a non-object in 'FilePath' on line 163
This is the code including the other way I have tried:
$DelEntry = $_POST['postEntry'];
echo $DelEntry;
//$query2 = "DELETE FROM Blog WHERE Title =\"" . $DelEntry . "\"";
//echo $query2;
//$result2 = mysqli_query($mysqli, $query2);
//if (!$result2) {
//die('Invalid query: ' . mysql_error());
//}
$stmt2 = $mysqli->prepare("DELETE FROM Blog WHERE Title = ?");
var_dump($DelEntry);
$stmt2->bind_param('s', $DelEntry);
$stmt2->execute();
$stmt2->close();
//header("Location: listall.php");
exit;
line 163 specifically is:
$stmt2->bind_param('s', $DelEntry);
Any help would really be appreciated, Thanks!
Thanks for the link @Qirel but none of those solutions have worked, I have closed all previous forms of $mysqli, attempted to enable PDOExceptions where its telling me it cannot be done on non-objects and I have checked that "DELETE FROM Blog WHERE Title = "Test Input"" does work with my database. Really stuck, any more help would be appreciated