I have made a page to remove different elements of my site, but for some reason it's not working... Event though i set the fMenu
to be i - integer, because it is.
When i run the code below, it gives me:
Fatal error: Call to a member function bind_param() on a non-object in C:\Users\joonas\Desktop\Le Kerouacoot\adminemove.php on line 44
Code(PHP):
include_once('../php/connDbPrepared.php');
mysqli_set_charset($mysqli, 'utf8');
//Anti mysql injection precautions
$menu = mysqli_real_escape_string($mysqli, $menu);
$sql = "REMOVE FROM menu WHERE fMenu = ?";
$stmt = $mysqli->prepare($sql);
$stmt->bind_param("i", $menu);
if($stmt->execute())
{
$stmt->close();
echo '
<script type="text/javascript">
window.location.replace("../admin/admintable.php?page=main&message=removeSuccessMenu");
</script>
';
}
else
{
echo '
<script type="text/javascript">
$(document).ready(function()
{
$("#screenCover").slideToggle("slow");
$("#closePopup").click(function()
{
$("#screenCover").slideToggle("slow");
setTimeout(resetPage, 600);
});
});
function resetPage()
{
window.location.replace("../admin/admintable.php?page=main");
}
</script>
<div id="screenCover" style="display:none;">
<div id="popup">
<div id="closePopupMain">
<p id="closePopup"><a href="#">X</a></p>
</div>
<p id="failure">Le menu n\'a pas éte enlevée! Cause: Erreur '.mysqli_errno($mysqli).": ".mysqli_error($mysqli).'</p>
</div>
</div>';
}