Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Aiheen aloitti: cddude - kesäkuu 18, 2014, 06:17:42 AP

Otsikko: Go through mysql result twice?
Kirjoitti: cddude - kesäkuu 18, 2014, 06:17:42 AP
Hey.

How would I go about doing this?


while ($row = $smcFunc['db_fetch_assoc']($request)){
...
}
...
while ($row = $smcFunc['db_fetch_assoc']($request)){
...
}


Thanks.
Otsikko: Re: Go through mysql result twice?
Kirjoitti: Dragooon - kesäkuu 18, 2014, 06:25:25 AP
Why do you need to go twice? Just run through it once and cache it into another array.
Otsikko: Re: Go through mysql result twice?
Kirjoitti: cddude - kesäkuu 18, 2014, 06:42:42 AP
Hmm, so I would need to put it into a 2d array?
Sorry, I'm quite new to php.
Otsikko: Re: Go through mysql result twice?
Kirjoitti: cddude - kesäkuu 19, 2014, 03:27:27 AP
Anyone?
Otsikko: Re: Go through mysql result twice?
Kirjoitti: Dragooon - kesäkuu 19, 2014, 03:28:13 AP
Yes you'd need a 2D array