effigy Posted July 5, 2006 Share Posted July 5, 2006 The code for this was taken from the manual page for mysqli_autocommit, with an additional test added to turn autocommit off.I am testing this on 2 boxes: 1. Windows, PHP 5.1.2, MySQL 5.0.18 2. Unix, PHP 5.1.4, MySQL 5.0.20aThe code gives the following results: 1. Windows: "Autocommit is 1 Autocommit is 0" 2. Unix: "Autocommit is 1 Autocommit is 1"Interestingly enough, if I replace [b]$mysqli->autocommit(FALSE);[/b] with [b]$mysqli->query('set autocommit = 0');[/b] it works.Has anyone seen this before, or worked with autocommit?Thanks.[code]<?php $mysqli = new mysqli("localhost", "---", "---"); 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(); } /* turn autocommit off */ $mysqli->autocommit(FALSE); if ($result = $mysqli->query("SELECT @@autocommit")) { $row = $result->fetch_row(); printf("Autocommit is %s\n", $row[0]); $result->free(); } /* close connection */ $mysqli->close();?> [/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.