I kinda skimmed, but I think what you want is foreach ( array_keys($SAVEVARS) as $key ) $query = "update table set $key=$SAVEVARS[$key];";
On Thursday 17 July 2003 02:38 pm, Mike Morton wrote: > Perhaps I was not that clear on the subject :) > > I have the following array: > > $SAVEVARS[headerimage]=$_POST[headerimage]; > $SAVEVARS[backgroundimage]=$_POST[backgroundimage]; > > I want to iterate through it to save to a database config: > > Forach($SAVEVARS as $whatever) { > $query="update table set $whatever=$whatever[$whatever]"; > } > > Where the 'set $whatever' would become 'set headerimage' and > '=$whatever[$whatever]' would become the value that was posted through and > set on the line above. > > The question is the - the assigned string key - is there a way to retrieve > that in a loop? Foreach, for, while or otherwise? -- "Humanity's first sin was faith; the first virtue was doubt." -Unknown -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php