MySQL Array Function -- mysql_fetch_array ()

Source: Internet
Author: User

MySQL has a unique function called MySQL array function. The following describes the MySQL Array Function-mysql_fetch_array ().

Mysql_fetch_array gets a row from the result set as an associated array, a number array, or both.

Calling this function in turn also returns the next row of the result set.

MySQL Array Function Syntax: mysql_fetch_array (resource result, result type)

The returned results are generally:
Array ([0] => 1 [ID] => 1 [1] => 58.215.76.161 [IP] => 58.215.76.161 [2] => linux [description] => linux [3] => 1 [4] => http [protocol] => http [5] => 80 [port] => 80 [6] => http [7] => check_http [command] => check_http)

If you only need to associate the array, the command parameter is
Mysql_fetch_array ($ rs, MYSQL_ASSOC) is equivalent to the function mysql_fetch_assoc ().

The returned result is

Array ([ID] => 1 [IP] => 58.215.76.161 [description] => linux [protocol] => http [port] => 80 [command] => check_http)

If you only need a number array, the command parameter is

Mysql_fetch_array ($ rs, MYSQL_NUM) is equivalent to the function mysql_fetch_row ().

The returned result is

Array ([0] => 1 [1] => 58.215.76.161 [2] => linux [3] => 1 [4] => http [5] => 80 [6] => http [7] => check_http)

MySQL date functions

Provides you with an in-depth understanding of the MYSQL Cast function.

How to view the three MySQL character sets

View MySQL Default Character Set

Role of MySQL Foreign keys in Databases

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.