RE: [PHP] PHP + MySQL looping question
| From: | Craig Thomas | Date: | Thu, 12 Dec 2002 22:04:21 +0000 |
| Subject: | RE: [PHP] PHP + MySQL looping question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128082@lists.php.net to get a copy of this message | ||
Set the new array before your for loops, then loop over the array.
-Craig
>>-----Original Message-----
>>From: Mark McCulligh [mailto:mmcculli@sykescanada.com]
>>Sent: Thursday, December 12, 2002 4:56 PM
>>To: php-general@lists.php.net
>>Subject: Re: [PHP] PHP + MySQL looping question
>>
>>
>>If I understand you if you use the mysql_query($sql) again won't
>>it rerun my
>>SQL again, not just reprint.
>>
>>Example:
>>
>>$result = mysql_query($sql);
>>for ($i = 1; $i <= 3; $i++) {
>> while ($row = mysql_fetch_array($result)) {
>> //Some Code
>> echo $row['filed'];
>> }
>> //Reset result array
>> $result = mysql_query($sql);
>>}
>>
>>--
>>_________________________________________
>>Mark McCulligh, Application Developer / Analyst
>>Sykes Canada Corporation www.SykesCanada.com
>>(888)225-6824 ex. 3262
>>mmcculli@SykesCanada.com
>>"Craig Thomas" <craig@januzzithomas.net> wrote in message
>>news:LEELKFJHHCMMHLKJLLOBGEJMCGAA.craig@januzzithomas.net...
>>> >>The problem is I have to reset the SQL result array on each for
>>> >>loop. How do
>>> >>you do that?
>>>
>>> $myNewArrayFullofSqlResultsThatICanLoopOverAsManyTimesAsIWant =
>>> mysql_query($sql);
>>>
>>> -Craig
>>>
>>
>>
>>
>>--
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>