title: What's wrong with my code? I'm having an error to call undefined method mysqli::error()
body: <p>I am getting an error</p>
  
  <blockquote>
    <p>Fatal error: Uncaught Error: Call to undefined method mysqli::error() in 
          C:\xampp\htdocs\dentalclinic\edit-index.php:83 Stack trace: #0 {main} thrown </p>
  </blockquote>
  
  <p>At this line</p>
  
  <pre><code>$mysqli-&gt;query("DELETE from schedule WHERE patient_id=$patient_id") or die($mysqli-&gt;error());
  </code></pre>
  
  <p>I keep changing the <code>die($mysqli-&gt;error())</code> to this <code>$mysqli-&gt;error</code> but I'm getting another error</p>
  
  <blockquote>
    <p>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</p>
  </blockquote>
  
  <p>I also change my code into this</p>
  
  <pre><code>$mysqli-&gt;query("DELETE from schedule WHERE patient_id='$patient_id'") or die($mysqli-&gt;error); 
  </code></pre>
  
  <p>Since I notice that I didn't put any single quote in my <code>$patient_id</code> and another error appear that says</p>
  
  <blockquote>
    <p>Unknown column 'patient_id' in 'where clause'</p>
  </blockquote>
  
  <p>Below is my whole code</p>
  
  <pre><code>&lt;?php
    $mysqli= new mysqli('localhost','root','','databasename') or 
  
    die(mysqli_error($mysqli));
  
    if(isset($_GET['delete'])){
  
      $mysqli-&gt;query("DELETE from schedule WHERE patient_id='$patient_id'") or die($mysqli-&gt;error);
  
    }
  </code></pre>
  
  <p>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.</p>