Reply to Re: looping in php

Your name:

Reply:


Posted by Rik on 10/25/72 11:45

william.clarke@gmail.com wrote:
>>> $result = mysql_query(some_query);
>>> while(mysql_fetch_array($result,MYSQL_ASSOC){
>>> //do stuff with it
>>> }
>> In the below, say I did whatever I wanted to do to with this record, ie.,
>> retrived a city to a temp variable. How do I move or goto the next
record?

That's what you do with mysql_fetch_array().

> As milahu and Rik said this is PHP looping through a result
> set...(maybe not in the VB sense). There isn't a direct equivalent to
> the VB6 recordset, but you don't need one.


Don't know much about VB, but if you want to handle it as a complete
recordset: instead of processing the rows one by one:

$myrecordset = array();
while($row = mysql_fetch_array($result,MYSQL_ASSOC){

$myrecordset[] = $row;
}

Et voilΰ, a multidimensional array to abuse as you which.

Grtz,
--
Rik Wasmus

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация