Home 类库下载 PHP类库 PHP mysqli_autocommit() function

PHP mysqli_autocommit() function

Oct 09, 2016 pm 12:52 PM

Definition and usage

mysqli_autocommit() function turns on or off automatic submission of database modifications.

Tip: Please take a look at the mysqli_commit() function, which is used to commit the current transaction for the specified database connection. Please see the mysqli_rollback() function for rolling back the current transaction.

Syntax

mysqli_autocommit(connection,mode);

PHP mysqli_autocommit() function

Technical details

PHP mysqli_autocommit() function

Example

Turn off autocommit, do some queries, and then submit the query:

<?php 
// 假定数据库用户名:root,密码:123456,数据库:RUNOOB 
$con=mysqli_connect("localhost","root","123456","RUNOOB"); 
if (mysqli_connect_errno($con)) 
{ 
    echo "连接 MySQL 失败: " . mysqli_connect_error(); 
} 
// 关闭自动提交
mysqli_autocommit($con,FALSE);
// 插入一些值
mysqli_query($con,"INSERT INTO websites (name, url, alexa, country)
VALUES (&#39;百度&#39;,&#39;https://www.baidu.com/&#39;,&#39;4&#39;,&#39;CN&#39;)");
// 提交事务
mysqli_commit($con);
// 关闭连接
mysqli_close($con);
?>
Copy after login


Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)