View Single Post
ישן 13-04-10, 23:11   # 11
IgalSt
מנהל פורום, עסק רשום
 
IgalSt's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: המרכז
גיל: 38
הודעות: 1,432
Send a message via Skype™ to IgalSt

IgalSt לא מחובר  

זה באמת לא משנה אם זה 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 
  Reply With Quote