Jump to content

what is mysqli_autocommit?


deathisonitsway

Recommended Posts

hi,Im from join from turkey...I have question...what is mysqli_autocommit? I did not find its response.

please, can you explain what is mysqli_autocommit?

 

<?php

$mysqli = new mysqli("localhost", "my_user", "my_password", "world");

 

if (mysqli_connect_errno()) {

    printf("Connect failed: %s\n", mysqli_connect_error());

    exit();

}

 

/* turn autocommit on */

$mysqli->autocommit(TRUE);

 

if ($result = $mysqli->query("SELECT @@autocommit")) {

    $row = $result->fetch_row();

    printf("Autocommit is %s\n", $row[0]);

    $result->free();

}

 

/* close connection */

$mysqli->close();

?>

 

 

why  this command autocommit 1 returned ?

 

regards

Link to comment
https://forums.phpfreaks.com/topic/88028-what-is-mysqli_autocommit/
Share on other sites

If you have read on a transaction database it is nothing get affected unless you commit. so if you insert a row, delete a row, or update it, it does not actually take place until you commit with autocommit it make the transaction complete meaning that immediately after running the statement the database is affected

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.