while ($rs =mysql_fetch_array ($result)), what to do with

Source: Internet
Author: User
while ($rs =mysql_fetch_array ($result))
1, ask this cycle, do not need to move the record pointer. Can we loop through the records?
2, $rs =mysql_fetch_array ($result) Does this expression return true, or is it equivalent to true if $rs has a value.

Thank you..

------Solution--------------------
If $rs has always been true, is that the cycle of death? , so when you get the array, the value of $rs is true, and when the array is read, the $rs is empty, which is false. I'm a novice, I understand.
------Solution--------------------
Mysql_fetch_array () is an extended version of Mysql_fetch_row ().

Mysql_fetch_row () Gets a row of data from the result set associated with the specified result identity and returns it as an array. Each result column is stored in an array of cells, with an offset starting at 0. Calling Mysql_fetch_row () in turn returns the next row in the result set, or FALSE if there are no more rows.

------Solution--------------------
Explore
The expression has a value, you can think of it as true, right?

------Solution--------------------
Of course, if there is a value then the array is returned, and the array is quite true.
------Solution--------------------
Characters with BOOL can be converted,
With two!! Number can be converted to bool (TRUE)

PHP Code
  • 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.