Mysql_fetch_row query results are not complete, why is interlaced display results?

Source: Internet
Author: User

Using the Mysql_fetch_row function to query the results of the database, display only the results of interlaced in the database, rather than the full result, excuse me for what reason? The code is as follows:

while(mysql_fetch_row($result)){    echo '
';    print_r(mysql_fetch_row($result));    echo '
';}

This code can only show part of the results,

Database:

2, use the following code to query all the results, why?

while($arr = mysql_fetch_row($result)){    echo '
';    print_r($arr);    echo '
';}

Reply content:

Using the Mysql_fetch_row function to query the results of the database, display only the results of interlaced in the database, rather than the full result, excuse me for what reason? The code is as follows:

while(mysql_fetch_row($result)){    echo '
';    print_r(mysql_fetch_row($result));    echo '
';}

This code can only show part of the results,

Database:

2, use the following code to query all the results, why?

while($arr = mysql_fetch_row($result)){    echo '
';    print_r($arr);    echo '
';}

It should be mysql_fetch_row ($result) Move the pointer back one after each execution
The first time is executed in parentheses after the while, no output
Then the code block executes once and outputs
And then loop the execution again without output
Then the code block executes once and outputs
Then the condition in the while is false, stop

Each fetch is equivalent to moving the pointer down one bit, the first one to move down two bits each time (while inside once, print_r inside once), so every other output.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.