title: Passing PHP variables into MySQL
body: <p>I have a function in PHP which inserts values into MYSQL tables.</p>
  
  <pre><code>function insertRow($db, $new_table, $ID, $Partner, $Merchant)
  {
      $insert = "INSERT INTO " .$new_table. " VALUES(number, "string", "string")"
      $q = mysqli_query($db, $insert);
  }
  </code></pre>
  
  <p>I am struggling customizing the VALUES part. I need the number, string, and string to be ID, Partner, and Merchant variables from PHP respectively.</p>
  
  <p>I've tried</p>
  
  <pre><code>function insertRow($db, $new_table, $ID, $Partner, $Merchant)
  {
      $insert = "INSERT INTO " .$new_table. " VALUES(" .$ID . $Partner . $Merchant . ")";
      $q = mysqli_query($db, $insert);
  }
  </code></pre>
  
  <p>as well. But it doesn't seem to work because for SQL the string values must be surrounded with quotes. But if I change the code so that its ."$ID" . "$Partner" . "$Merchant" . ")"; and thus the variables are in quotes as needed, they are no longer PHP variables. How do I get my PHP variables to be included in quotes so that I can execute the SQL correctly?</p>