I've been stuck on this for an hour.
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.
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?
Suggestions?
$l = 1;
while ($l <= $num_rows) {
$query = "UPDATE records SET recordListingID = $recordsQuestion_" . $l . " WHERE recordID = " . $l;
mysql_query($query) or die(mysql_error());
$l++;
};
or die, don't use it if you're outputting HTML.