Solved

Recordsets in php

Posted on 2007-03-18
5
350 Views
Last Modified: 2007-03-18
Are recordsets still used in PHP?  The reason why I ask is because in ASP I always use a formula like:

Do while not rs.eof
variable = rs("field")
variable = rs("field")

To make a loop.
0
Comment
Question by:pingeyeg
  • 3
  • 2
5 Comments
 
LVL 4

Accepted Solution

by:
cx323 earned 250 total points
ID: 18744501
I don't know asp, but do you mean something like this:

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)){
      $variable = $row['field'];
        $variable2 = $row['field2'];
}
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18744513
What about a movenext function.  Like this is what I'm used to:

 rs.movenext
   if not rs.eof then
  variable = rs("field")
0
 
LVL 4

Expert Comment

by:cx323
ID: 18744545
the while loop will automatically move through the recordset until nothing is left.  you don't need to increment it manually
0
 
LVL 1

Author Comment

by:pingeyeg
ID: 18744564
Well my thing is I am trying to make two values per row.  I am just trying to find out what the equivalent is in php.
0
 
LVL 4

Assisted Solution

by:cx323
cx323 earned 250 total points
ID: 18744592
so you want two variables created from the row of data?  the first snippet should do that
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question