Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9255355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:41:57+00:00 2026-06-18T11:41:57+00:00

I am using mysql extension in php, I know it is deprecated as of

  • 0

I am using mysql extension in php, I know it is deprecated as of PHP 5.5.0, but I have a lot of code allready written with the use of this extension.
It seems to me like mysql_query commits the query, if so it means that it is set to autocomit, How to setup so it does not autocommit.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T11:41:59+00:00Added an answer on June 18, 2026 at 11:41 am

    The old mysql extension doesn’t have functions specifically for transaction control, but you can issue SQL statements to do what you want.

    You can implicitly turn off autocommit for the duration of one transaction simply by starting a transaction:

    mysql_query("START TRANSACTION");
    

    As soon as you COMMIT or ROLLBACK, the autocommit mode will return to the default.

    mysql_query("COMMIT"); // or ROLLBACK
    

    You can turn off autocommit for your whole session by setting a session variable:

    mysql_query("SET autocommit=0");
    

    Or change it globally on your MySQL instance so it changes the default for all sessions:

    mysql_query("SET GLOBAL autocommit=0");
    

    Or set it to change the global setting upon MySQL service startup by editing /etc/my.cnf:

    [mysqld]
    autocommit=0
    

    If you use MySQL 5.1, you have to do this slightly differently:

    [mysqld]
    init_connect='SET autocommit=0'
    

    You probably already know, but it bears repeating that transactions only mean anything if you’re using InnoDB tables. MyISAM tables don’t support transactions, so they’re always autocommit regardless of your settings. Same with several other storage engines, including MEMORY and CSV.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Using MySQL and PHP) I have a search form that will allow my users
Using PHP v. 5.2.14 and PDO-MySQL extension. I am new to prepared statements. Need
I have a PHP extension ( APC ) which I've built using PECL. I've
this question is Basic but important. i need to rewrite php url using .htaccess
I am using the Geospatial extension for MySQL. In the MyISAM table listings there
Using MySQL, I have a simple table that logs the IP Address that users
Using mysql 5.5.2 on windows (Wamp) I'm writing a Java application that use several
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
Im using MySQL with PDO PHP scripts to maintain a user database and a
Currently using MySQL version 5.1.6 This is my first real world build and so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.