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

  • Home
  • SEARCH
  • 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 6989223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:11:01+00:00 2026-05-27T19:11:01+00:00

I performed a query and captured the results in a variable called $raw_results ;

  • 0

I performed a query and captured the results in a variable called $raw_results;

I then have the following:

$record_set = mysql_fetch_array($raw_results);

echo "<pre>";
print_r($record_set);
echo "</pre>";

echo "<hr />";

And right below it, I have:

while ($record_set = mysql_fetch_array($raw_results))
{
echo "<pre>";
print_r($record_set);
echo "</pre>";
}

I’m surprised (and confused) that the while loop starts at record #2 in the array instead of record #1.

If I remove the block above the loop, then the loop displays record #1 as I originally expected.

Why is the loop being affected by the block above it?

Thanks in advance for taking the time. Cheers.

  • 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-27T19:11:02+00:00Added an answer on May 27, 2026 at 7:11 pm

    Each call to mysql_fetch_array() advances the record pointer in the result resource $raw_results. So the initial call has already advanced it to the second record. The next call, whether in a loop or singly, will retrieve the next (second) row.

    To rewind it back to the first record, you can use mysql_data_seek():

    mysql_data_seek($raw_results, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following SQL query that selects some results from my table: select avg(c3),
I have performed an LDAP:// query to get a list of computers within a
I'm modifying someone else's code where a query is performed using the following: DataSet
Hii, I have a query string like http://project/page1.aspx?userID=5 . The operation won't be performed,
I have a query that updates a boolean value for a given record, then
I have a query that I'd like to pre-compile, however the query is being
I've declared a table variable '@t', and have correctly performed the 'INSERT-INTO-SELECT'. When I
I performed the following query on a MyISAM table three times in a row:
The following query hangs: (although subqueries perfomed separately are fine) I don't know how
I'm having some problems trying to perform a query. I have two tables, one

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.