title: PHP Passing two id in the URL
body: <p>I am trying to pass two ID to delete a record. The first ID that will be pass is the ID of the history record of the patient to delete. The second ID is the Primary ID of the patient foreign key to the table of history records. Once I deleted the history record of the patient it will redirect back to the profile of that patient.</p>
  
  <p>Here is the code in in my table action:</p>
  
  <pre><code>&lt;td&gt;&lt;a class="text-danger" onClick="return confirm('Are you sure you want to clear this record?')" href="clear_records.php?id=&lt;?php print $rows4['id'];?&gt;?p_id=&lt;?php print $rows5['p_id']; ?&gt;"&gt;&lt;i class="fa fa-times text-danger"&gt;&lt;/i&gt;Clear&lt;/a&gt;&lt;/td&gt;
  </code></pre>
  
  <p>and here is the code in <strong>clear_records.php</strong></p>
  
  <pre><code>&lt;?php
  include "../config.php";
  
  $id = $_REQUEST['id'];
  $p_id = $_REQUEST['p_id'];
  // sql to delete a record
  $sql = "DELETE FROM nutritional_records WHERE id=$id";
  
  if ($conn-&gt;query($sql) === TRUE) {
      header("location: preschooler_profile.php?p_id=$p_id");
  } else {
      echo "Error Clearing record: " . $conn-&gt;error;
  }
  
  $conn-&gt;close(); 
  ?&gt; 
  </code></pre>
  
  <p>This is the error:</p>
  
  <blockquote>
    <p>Error Clearing record: You have an error in your SQL syntax; check the
    manual that corresponds to your MySQL server version for the right
    syntax to use near '?p_id=00023' at line 1</p>
  </blockquote>
  
  <p>and here is my url looks like:</p>
  
  <p><a href="http://localhost/NutriCare/admin/clear_records.php?id=8?p_id=00023" rel="nofollow noreferrer">http://localhost/NutriCare/admin/clear_records.php?id=8?p_id=00023</a></p>
  
  <p>Looking for help.
  Thanks in advance.</p>