Hi,
I have been getting this error everytime:
Warning: mysqli_query() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\healthcentre\member_Delete.php on line 28
success!DELETE failed
I have been trying for a few hours to work this out.
Below is the code:
<?php
ob_start();
// connection detail
$host = "localhost";
$user = "root";
$pwd = "";
$db ="healthcentre";
// establish a connection
$conn = mysqli_connect($host,$user,$pwd,$db);
if($conn == false){
echo "connection has failed";
}
// fetch the customer id from the url parameter and store inside $customerId variable.
$memberId=$_REQUEST['id'];
// run a query to delete the selected customer
$sql="DELETE FROM member WHERE member_id='$memberId'";
//echo "success!";
$res=mysqli_query($sql,$conn);
echo "success!";
// returm back to the customerList.php if delete is successful.
if($res == true){
header('Location:member_list.php');
}
else
{
echo "DELETE failed".mysqli_error($conn);
}
ob_flush();
?>
Any help/ideas on how to make this work?? 😕
Thanks