title: MySQL Update with PHP variables in a loop
body: <p>I've been stuck on this for an hour.</p>
  
  <p>I've got a series of variables ($recordsQuestion_1, $recordsQuestion_2, etc). Since the total number of these variables changes, I want to update my DB in a loop. However, I can't figure out how to actually store the variable. Just $l or "recordsQuestion_1 (2, 3, etc)" into the DB.</p>
  
  <p>Here's what I've got, tried grasping variable variables (not even sure if that's how to do it), but couldn't get anything to work. Maybe an array?</p>
  
  <p>Suggestions?</p>
  
  <pre><code>$l = 1;
  while ($l &lt;= $num_rows) {
      $query = "UPDATE records SET recordListingID = $recordsQuestion_" . $l . " WHERE recordID = " . $l;
      mysql_query($query) or die(mysql_error());
      $l++;   
  };
  </code></pre>