Solved

Recordsets in php

Posted on 2007-03-18
5
348 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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses four methods for overlaying images in a container on a web page
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now