Tutorial on learning mysql () function _ php in PHP

Source: Internet
Author: User
Learn the mysql () function in php. Database server connection statement; 3. mysql_query (1, 2) :( 1) SQL statement, (2) connection identifier. if not, use the previous database server connection statement; 4. set the encoding language

Database server connection statement;

3. mysql_query (1, 2): (1) SQL statement, (2) connection identifier. if not, use the previous Database Connection Server statement;

4. set the encoding statement: (1) mysql_query ("set names 'utf8'"); (2) mysql_set_charset ('utf8'); (garbled characters appear when no encoding is set );

5. mysql_fetch_array (1, 2) :( 1) the specified data pointer is returned through the mysql_query () function; (2) optional parameter; array type (MYSQL_ASSOC/MYSQL_NUM/MYSQL_BOTH); default value: MYSQL_BOTH, contains correlated and numeric arrays. note: after the specified data is obtained, this function specifies the next record. if you continue to request this function, the next record is returned; the official website said that the field names returned by this function are case-sensitive. the test is not sensitive. of course, it is in the windows XP operating system. Other systems are unknown;

6. mysql_free_result (data): releases the result memory. data is the result returned from mysql_query (). it is called only when considering how much memory will be occupied when a large result set is returned, when the script ends, all associated memory will be automatically released (not clear or understandable );

Example 3. mysql_query (1, 2) :( 1) SQL statement, (2) connection identifier. if not, use the previous connection database server statement; 4. set the encoding language...

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.