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);

In the above two queries the first doesn't execute correctly (transaction doesn't work) due to performing the queries individually by calling the mysql_query functions multiple occasions. However i require it do be carried out by by doing this. That's i want the end result through the first way (calling mysql_query function several occasions for any single transaction)

Any IDEA please???

Using 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 produce 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 technology-not only later:

mysql_query('CALL weirdrolledbackdelete(4);');