<?php
$connect=mysql_connect("localhost","root","");
mysql_select_db("bank",$connect) or die ("could not select database");
$account_number='';
$tran_id='';
if(isset($_POST['account_number']))
$account_number=$_POST['account_number'];
else
$account_number='';
//getting the faulty transaction
$query = "select * from transaction WHERE account_number='$account_number'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($result);
//Correcting the account table
if(strtolower('transaction_type')=="deposit"){
$operator = "-";
}else{
$operator = "+";
}
$query= "UPDATE account SET `account_balance`=(`account_balance`".$operator.$row['transaction_amount'].") WHERE account_number='$account_number'";
mysql_query($query) or die(mysql_error());
//deleting the faulty transaction
$query = "DELETE from transaction WHERE account_number='$account_number'";
mysql_query($query) or die(mysql_error());
?>
Also, TBH, now you really should be using mysqli rather than mysql.