This is a discussion on looping in php within the PHP Language forums, part of the PHP Programming Forums category; william.clarke@gmail.com wrote: >>> $result = mysql_query(some_query); >>> while(mysql_fetch_array($result,MYSQL_ASSOC){ >>&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
Thanks for all replies, I finally figured out looping in php.
"Rik" <luiheidsgoeroe@hotmail.com> wrote in message news:e27hua$i4k$1@netlx020.civ.utwente.nl... > 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 > > > |