• PHP Video Tutorials

PHP mysqli_dump_debug_info() Function



Definition and Usage

The mysqli_dump_debug_info() function accepts a object representing a connection to the MySQL server and, dumps the debugging information in to the log.

Syntax

mysqli_dump_debug_info($con);

Parameters

Sr.No Parameter & Description
1

con(Mandatory)

This is an object representing a connection to MySQL Server.

Return Values

This function returns the boolean value which is, TRUE on success and FALSE in case of failure.

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_dump_debug_info() function (in procedural style) −

<?php
   //Creating a connection
   $con = mysqli_connect("localhost", "root", "password", "mydb");
   $res = mysqli_dump_debug_info($con);

   if($res){
      print("Debugging is successful");
   }else{
      print("Failed to debug");
   }
?>

This will produce following result −

Debugging is successful

Example

<?php
   $servername = "localhost";
   $username = "root";
   $password = "password";
   $dbname = "mydb";
   $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_dump_debug_info($conn);
   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