Solved

Recordsets in php

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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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.

617 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