CameronDane
05-06-2009, 07:07 PM
I am trying to dynamically update some fields. I managed to dynamically create the table columns and values. However I am stumped on the final update piece.
The problem is that I can only store the variable that contains the columns and values variables from with in the for loop. As such if I put the Update table_name Set... in there it will run that through the for. How do I get the data out of the loop so I can have only one big update?
Here is my code....
for ($d=1; $d < $numfields; $d++) {
$data{$d} =",". $column{$d}."='". $field{$d}."'<br>";
echo $data{$d};
}
//echo $data{$d}; If I do this it grabs the last row?
The problem is that I can only store the variable that contains the columns and values variables from with in the for loop. As such if I put the Update table_name Set... in there it will run that through the for. How do I get the data out of the loop so I can have only one big update?
Here is my code....
for ($d=1; $d < $numfields; $d++) {
$data{$d} =",". $column{$d}."='". $field{$d}."'<br>";
echo $data{$d};
}
//echo $data{$d}; If I do this it grabs the last row?