PHP mysql_info() 函數
定義和用法
mysql_info() 函數返回最近一條查詢的信息。
如果成功,則返回有關該語句的信息,如果失敗,則返回 false。
語法
mysql_info(connection)
參數 | 描述 |
---|---|
connection | 可选。規定 MySQL 連接。如果未規定,則使用上一個連接。 |
description
mysql_info() returns the connection details of the latest query performed. If no connectionAssumed to be the last opened connection.
mysql_info() returns a string for all the following statements listed:
INSERT INTO ... SELECT ... INSERT INTO ... VALUES (...),(...),(...)... LOAD DATA INFILE ... ALTER TABLE UPDATE
Returns false for any other statements. The format of the string depends on the given statement.
Example
<?php $con = mysql_connect("localhost", "hello", "321"); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db("test_db",$con); $sql = "INSERT INTO person VALUES ('Bill','Gates','Utah','19')"; $result = mysql_query($sql,$con); $info = mysql_info($con); echo $info; mysql_close($con); ?>
Output similar to:
String format: Records: 15 Duplicates: 0 Warnings: 0