• PHP Video Tutorials

PHP mysqli_debug() Function



Definition and Usage

The mysqli_debug() function accepts a string value representing the required debugging operation to be performed as a parameter and, performs it using the Fred Fish debugging library.

Syntax

mysqli_debug($message);

Parameters

Sr.No Parameter & Description
1

message(Mandatory)

This is a string value representing the required debugging operation to be performed.

Return Values

This function returns the boolean value true.

PHP Version

This function was first introduced in PHP Version 5 and works works in all the later versions.

Example

Following example demonstrates the usage of the mysqli_debug() function (in procedural style) −

<?php
   $debug = mysqli_debug("T:n:t:m:x:F:L:o,/sample.txt");
   print($debug);
?>

This will produce following result −

1

Example

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

   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);
?>

This will produce following result −

Success... localhost via TCP/IP
php_function_reference.htm
Advertisements