MySQLi - Debug



Syntax

bool mysqli_debug ( string $message )

Definition and Usage

It used to performs debugging operations.

Example

Try out following example −

<?php
   $servername = "localhost:3306";
   $username = "root";
   $password = "";
   $dbname = "TUTORIALS";
   $conn = new mysqli($servername, $username, $password, $dbname);

   if ($conn->connect_error) {
      die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
   } 
   echo 'Success... ' . mysqli_get_host_info($conn) . "\n";
   mysqli_debug("d:t:o,debug.txt");
   mysqli_autocommit($conn,FALSE);
   mysqli_query($conn,"INSERT INTO tutorials_auto (id,name)
   
   VALUES (10,'sai')");
   mysqli_commit($conn);
   
   mysqli_close($conn);
?>

The sample output of the above code should be like this −

Success... localhost:3306 via TCP/IP

In the above example, it performs debugging operations and store the information on debug.txt file

mysqli_useful_functions.htm
Advertisements