title: JSON/PHP Array to MYSQL insert
body: <p>I have a JSON array that I convert to a PHP array resulting in a series of IDs such as:</p>
  
  <pre><code>   Array
     (
        [0] =&gt; 2343
        [1] =&gt; 4345
        [2] =&gt; 4432
        [3] =&gt; 3456
     )
  </code></pre>
  
  <p>I would like to insert these image IDs into the database with a common gallery ID - Here is how it would look if I was to write each query individually:</p>
  
  <pre><code>$query1 = "INSERT INTO gallery_media (media_id, gallery_id) VALUES ('2343', '1')";
  $query2 = "INSERT INTO gallery_media (media_id, gallery_id) VALUES ('4345', '1')";
  $query3 = "INSERT INTO gallery_media (media_id, gallery_id) VALUES ('4432', '1')";
  $query4 = "INSERT INTO gallery_media (media_id, gallery_id) VALUES ('3456', '1')";
  </code></pre>
  
  <p>How would I somehow loop this to make it as simple an efficient as possible? Any help would be much appreciated.</p>