title: How to insert data into table that contain foreing keys using php?
body: <p>I am still learnig using php, and I got some problems.
  So, I have a database named dbcoma and these tables;
  <a href="https://i.stack.imgur.com/UtoRN.png" rel="nofollow noreferrer">pic of tables and the data</a></p>
  
  <p><strong>here is my question</strong> if I wanna make a registration for patient using php, what is the correct script? </p>
  
  <p>I tried this one but it wasn't working (cant execute)</p>
  
  <pre><code>public function createPasien($id_alat, $id_patient, $passwordpas, $namepas, $age, $datein, $id_hospital, $id_alat){
      $password = md5($passwordpas);
      $stmt = $this-&gt;con-&gt;prepare("INSERT INTO `dbcoma`.`patient` (`id_patient`, `passwordpas`, `namepas`, `age`, `datein`, `id_alat`, `id_hospital`) VALUES (?, ?, ?, ?, ?, ?, ?);");
      $stmt-&gt;bind_param("sssssss", $id_patient, $passwordpas, $namepas, $age, $datein, $id_alat, $id_hospital);
      $stmt-&gt;execute();
      // …
  }
  </code></pre>
  
  <p><strong>UPDATE: I FIXED IT AND FOUND THE PROBLEM. THANK YOU</strong></p>