mysqli::$info
(mysqli_info)檢索有關最近執行的查詢的信息
info
/ mysqli_info()
函數返回有關上次執行的查詢的信息。
此函數適用於以下查詢類型:
返回有關上次執行的查詢的信息:
<?php $mysqli = new mysqli ( "localhost" , "my_user" , "my_password" , "my_db" ) ; if ( $mysqli -> connect_errno ) { echo "Failed to connect to MySQL: " . $mysqli -> connect_error ; exit ( ) ; } // 執行一些查詢 $mysqli -> query ( "CREATE TABLE testPersons LIKE Persons" ) ; $mysqli -> query ( "INSERT INTO testPersons SELECT * FROM Persons ORDER BY LastName" ) ; echo $mysqli -> info ; $mysqli -> close ( ) ; ?>
返回有關上次執行的查詢的信息:
<?php $con = mysqli_connect ( "localhost" , "my_user" , "my_password" , "my_db" ) ; if ( mysqli_connect_errno ( ) ) { echo "Failed to connect to MySQL: " . mysqli_connect_error ( ) ; exit ( ) ; } // 執行一些查詢 mysqli_query ( $con , "CREATE TABLE testPersons LIKE Persons" ) ; mysqli_query ( $con , "INSERT INTO testPersons SELECT * FROM Persons ORDER BY LastName" ) ; echo mysqli_info ( $con ) ; mysqli_close ( $con ) ; ?>