MySQLi - Stat

语法

string mysqli_sqlstate ( mysqli $link )

定义和用法

用于设置LOAD DATA LOCAL INFILE命令的回调函数

示例

试试下面的例子 −

<?php
   $servername = "localhost:3306";
   $username = "root";
   $password = "";
   $dbname = "TUTORIALS";
   $conn = new mysqli($servername, $username, $password, $dbname);
   
   if (!$conn->real_connect($servername, $username, $password, $dbname)) {
      die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
   }
   echo "Database connected";

   if (!$conn->query("CREATE TABLE tutorialspoint_1 (ID INT, Name VARCHAR(30))")) {
      printf("Error - SQLSTATE %s.
", $mysqli->sqlstate);
   }

   mysqli_close($conn);
?>

上述代码的示例输出应该是这样的 −

Database connected

mysqli_useful_functions.html