זה באמת לא משנה אם זה for each או סתם for. בסופו של דבר זה אותו הדבר (כמעט) לחלוטין.
אתה מדבר על משהו כזה? (סליחה שזה ב-vbscript, לא כותב PHP)
PHP קוד:
Dim ValuesArr(x)
'fill of you ValuesArr
sql="Update tblName Set "
for i=0 to x
sql=sql&" Field"&i&" = '"&ValuesArr(i)&"', "
next
'remove the comma on the right at the end of sql str
sql=sql&" Where Something='SomethingElse'"
execute your sql
ואם כבר, אז דוגמא מתוקנת שמשתמשת ב-for each:
PHP קוד:
Dim ValuesArr(x)
'fill of you ValuesArr
sql="Update tblName Set "
i=0
for each value ValuesArr
sql=sql&" Field"&i&" = '"&value&"', "
i=i+1
next
'remove the comma on the right at the end of sql str
sql=sql&" Where Something='SomethingElse'"
execute your sql