Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.