I am getting an error
Fatal error: Uncaught Error: Call to undefined method mysqli::error() in C:\xampp\htdocs\dentalclinic\edit-index.php:83 Stack trace: #0 {main} thrown
At this line
$mysqli->query("DELETE from schedule WHERE patient_id=$patient_id") or die($mysqli->error());
I keep changing the die($mysqli->error())
to this $mysqli->error
but I'm getting another error
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near
I also change my code into this
$mysqli->query("DELETE from schedule WHERE patient_id='$patient_id'") or die($mysqli->error);
Since I notice that I didn't put any single quote in my $patient_id
and another error appear that says
Unknown column 'patient_id' in 'where clause'
Below is my whole code
<?php
$mysqli= new mysqli('localhost','root','','databasename') or
die(mysqli_error($mysqli));
if(isset($_GET['delete'])){
$mysqli->query("DELETE from schedule WHERE patient_id='$patient_id'") or die($mysqli->error);
}
My result suppose to be is to delete the row that I'm deleting in my table and will read the patient_id and give its given id.