Solved

Recordsets in php

Posted on 2007-03-18
5
353 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

734 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