وظيفة mysql_info() في PHP

التعريف والاستخدام

يعود mysql_info() بمعلومات حول آخر استعلام.

إذا كانت النتيجة ناجحة، يتم إرجاع معلومات حول هذه الجملة، وإذا كانت الفشل، يتم إرجاع false.

النحو

mysql_info(connection)
الم 参数 وصف
connection اختياري. يحدد الاتصال بـ MySQL. إذا لم يحدد، يتم استخدام الاتصال السابق.

Description

mysql_info() returns through the given connection Details of the latest query performed. If not specified connectionAssumed to be the last opened connection.

mysql_info() returns a string for all statements listed below:

INSERT INTO ... SELECT ...
INSERT INTO ... VALUES (...),(...),(...)...
LOAD DATA INFILE ...
ALTER TABLE
UPDATE

Returns false for any other statement. 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