Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6958745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:10:51+00:00 2026-05-27T15:10:51+00:00

Currently I use in my projects ADODB library for integration with the database. I

  • 0

Currently I use in my projects ADODB library for integration with the database.
I want to migrate to PDO, but I have a question about the consultations.

Currently, with the ADODB I do a query and use the row with the set numerous times using the method MoveFirst().

Example:

//I consultation
$rs = $conn->execute('select * from mytable');

//Loop through the results
while(!$rs->EOF) {
    echo $rs->fields('name');
    $rs->MoveNext();
}

//I move the "pointer" to the beginning of the list
$rs->MoveFirst();

//I can go over the results without needing to re-select
while(!$rs->EOF) {
    echo $rs->fields('name');
    $rs->MoveNext();
}

I wonder if there is any way similar in PDO, so I do not need to run the query again.
The goal is to avoid unnecessary queries on the bench more often since they use the same query.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T15:10:51+00:00Added an answer on May 27, 2026 at 3:10 pm

    I’m not sure why you want to loop through the result set more than once over the database connection. Why pull the data over the network again when you can just retrieve and save it the first time? But what you are looking for is a scrollable cursor, which isn’t supported by mysql. At least not through any PHP/MySQL driver. You may also want to look into buffered/unbuffered queries, which is supported by PDO.

    PDO::CURSOR_SCROLL
    http://www.php.net/manual/en/pdo.prepare.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have many projects that use a common base of shared components (dlls). Currently
I have an application with many sub projects, currently I use maven2 to compile
I have two projects that currently use SVN and I'm migrating to git, I
We have (currently) working projects that use Javascript API to get the Facebook session
I currently use visual studio 2008 for creating projects that can run on windows.
I currently use a basic BBCode script for my projects. The problem is, BBCode
We currently use Cradiator to display the status of our continuous integration (CI) builds
We currently use MyEclipse with its built-in Maven4MyEclipse integration and its built-in J2EE server
I currently use SVN and have a framework that I use on all of
Currently we have couple projects that are written in Delphi 6. Because of specific

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.