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 924743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:24:31+00:00 2026-05-15T19:24:31+00:00

QUERY 1: $link = mysql_connect(‘localhost’, ‘root’, ”); mysql_select_db(‘rems’, $link); mysql_query(‘SET AUTOCOMMIT=0; START TRANSACTION’, $link);

  • 0

QUERY 1:

$link = mysql_connect('localhost', 'root', '');
mysql_select_db('rems', $link);
mysql_query('SET AUTOCOMMIT=0; START TRANSACTION', $link);
mysql_query('DELETE FROM admins WHERE admin_id=4', $link);
mysql_query('ROLLBACK; SET AUTOCOMMIT=1', $link);

QUERY 2:

$link = mysql_connect('localhost', 'root', '');
mysql_select_db('rems', $link);
mysql_query('SET AUTOCOMMIT=0;START TRANSACTION;
    DELETE FROM admins WHERE admin_id=4;
    ROLLBACK; SET AUTOCOMMIT=1', $link);

From the above two queries the first one does not execute properly (transaction does not work) because of executing the queries separately by calling the mysql_query functions multiple times. But i need it do be done by this way. That is i need the result by the first way (calling mysql_query function several times for a single transaction)

Any IDEA please???

  • 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-05-15T19:24:32+00:00Added an answer on May 15, 2026 at 7:24 pm

    With the standard mysql module, either call every query seperately:

    mysql_query('SET AUTOCOMMIT=0');
    mysql_query('START TRANSACTION');
    mysql_query('DELETE FROM admins WHERE admin_id=4');
    mysql_query('ROLLBACK');//nothing will be done, I assume it's for testing
    mysql_query('SET AUTOCOMMIT=1');
    

    Or create a procedure first:

    DELIMITER //
    CREATE PROCEDURE weirdrolledbackdelete (IN oid INTEGER)
    BEGIN
    SET AUTOCOMMIT=0;
    START TRANSACTION;
    DELETE FROM admins WHERE id = oid;
    ROLLBACK;
    SET AUTOCOMMIT=1;
    END;//
    

    So you can use it later:

    mysql_query('CALL weirdrolledbackdelete(4);');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<?php $objConnect = mysql_connect(localhost,,root) or die(mysql_error()); $objDB = mysql_select_db(mydb); $pic2 = SELECT * FROM
Can the same mysql resource be used for multiple queries? $queries=array($q1, $q2); $link=mysql_connect(...); mysql_select_db(...);
<?php $con = mysql_connect (localhost, user, pass) or die ('Error: ' . mysql_error()); mysql_select_db
<?php session_start(); if(isset($_POST['username']) && ($_POST['password'])) { $con=mysql_connect(localhost,root,); if(!$con) { die('Could Not Connect:'.mysql_error()); } mysql_select_db(tcs,$con);
<?php /** Connect to DB */ mysql_connect(localhost, dbuser, pass) or die(mysql_error()); mysql_select_db(dbname) or die(mysql_error());
I already have done this: mysql_set_charset(utf8,$link); at the connection mysql_query(SET NAMES 'UTF8'); at the
I keep getting this error: Warning: mysql_query() [function.mysql-query]: Access denied for user 'mcabinet'@'localhost' (using
Ok I want my link query to return a list of users. Below is
Could someone please give me a link on how to create a query in
I'm having this link statement: List<UserGroup> domains = UserRepository.Instance.UserIsAdminOf(currentUser.User_ID); query = (from doc in

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.