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...