PHP - Function MySQLi Client Encoding



Syntax

mysqli_autocommit(connection,mode);

Definition and Usage

It is used to turn off or turn of auto-committing database modifications.

Return Values

It returns true on success or false on failure

Parameters

Sr.No Parameters & Description
1

connection

It specifies the number of connection to use in php

2

mode

It specifies turn off or turn on mode

Example

Try out the following example −

<?php
   $connection = mysqli_connect("host_name","user_name","password","db_name");
   
   if (mysqli_connect_errno($connection)){
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
   
   mysqli_autocommit($connection,FALSE);
   
   mysqli_query($connection,"INSERT INTO emp (FirstName)VALUES ('PHP')");
   mysqli_query($connection,"INSERT INTO emp (FirstName)VALUES ('Java')");
   
   mysqli_commit($connection);
   mysqli_close($connection);
?>
php_function_reference.htm
Advertisements