1. Connect to the database
$link = mysql_connect(server,user,password)
Returns a connection ID, returns false on failure
2.Set the connection code
mysql_set_charset('utf8',$link)
3.Select the database
mysql_select_db(database,$link)
4. Execute sql command
$result = mysql_query(sql)
If no data is returned, true will be returned if successful, false will be returned if failed
If data is returned, the data set will be returned successfully, false will be returned if failed
5. Commonly used functions
1. mysql_fetch_array(data,array_type) gets a row from the result set as an associative array or a numeric array, or both
data is $result, Result set
array_type: MYSQL_ASSOC: Associative array
MYSQL_NUM: Numeric array
MYSQL_BOTH: By default, both associative arrays and numeric arrays are generated
2. mysql_fetch_assoc(data) gets a row from the result set as an associative array
3. mysql_fetch_row(data) gets a row from the result set as a numeric array
4. mysql_num_fields( data) returns the number of fields in the result set
5. mysql_num_rows(data) returns the number of rows in the result set