We now have a youtube channel. Subscribe!

PHP | mysqli_dump_debug_info() Function

PHP mysqli_dump_debug_info() Function


Hello folks! welcome back to a new edition of our tutorial on PHP. In this tutorial guide, we are going to be studying about the PHP mysqli_dump_debug_info() Function.

The built-in PHP mysqli_dump_debug_info() function accepts an object representing a connection to the MYSQL server and, then dumps the debugging information into the log.

Syntax

Following below is the syntax to use this function -

mysqli_dump_debug_info($con);


Parameter Details

Sr.NoParameter & Description
1

con(Mandatory)

This is an object representing a connection to MySQL Server.


Return Value

This built-in PHP functions returns TRUE on success and FALSE on failure.

PHP Version

This built-in function was first introduced in PHP version 5 and it works in all of the later versions.

Example1

Following example illustrates the usage of the built-in PHP 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");
   }
?>

Output

When the above code is executed, it will produce the following result -

Debugging is successful

Example2

Try the following example below -

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

Output

When the above code is executed, it will produce the following result -

Success... localhost via TCP/IP


Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial, we are going to be studying about the PHP mysqli_error() Function.

Do feel free to ask your questions where necessary and we will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Do follow us on our various social media handles available and also subscribe to our newsletter to get our tutorial posts delivered directly to your emails.

Thanks for reading and bye for now.

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.
© 2023 ‧ WebDesignTutorialz. All rights reserved. Developed by Jago Desain