mysqli_query( $conn, "set names 'utf8'" ); //Set the character encoding
mysqli_close( $conn ); //Close the connection
$conn = new mysqli( 'localhost', 'Library name', 'Library password' );//Create a connection
if ( $conn->connect_error ) {
die( "Connection failed: " . $ conn->connect_error );
}//Detect connection
$result = mysqli_query( $conn, $sql );
$row = mysqli_fetch_assoc( $result ) ;//Check for phrases
The above is the detailed content of Commonly used functions for php native operation database. For more information, please follow other related articles on the PHP Chinese website!