Home > Article > Backend Development > Learn the mysql() function in php_PHP tutorial
Connect to database server statement;
3.mysql_query(1,2): (1) sql statement, (2) connection identifier, If not, use the previous connection database server statement;
4. Set encoding statement: (1) mysql_query("set names 'utf8'"); (2) mysql_set_charset('utf8'); (garbled characters will appear when there is no setting);
5.mysql_fetch_array(1,2): (1) The specified data pointer, returned through the mysql_query() function; (2) Optional parameter, array type (MYSQL_ASSOC/MYSQL_NUM/MYSQL_BOTH), the default is MYSQL_BOTH , including associative arrays and numeric arrays; Note: After the specified data is obtained, this function will specify the next record. If you continue to request this function, the next record will be returned; the official website says that the field names returned by this function are case-sensitive , it is not sensitive after testing. Of course, it is under the Windows XP operating system. I don’t know about other systems yet;
6.mysql_free_result(data): Releases the result memory. data is the result returned from mysql_query(); it only needs to be called when considering how much memory will be occupied when returning a large result set. All associated when the script ends The memory will be released automatically (I don’t understand or understand);