Solved

Recordsets in php

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to count occurrences of each item in an array.
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 …

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