Hello
I've two functions in my php page
The first connect to a mssql database and decrease a counter
function mvm_updateAvailableSms
$conn = odbc_connect(mssql_dsn, mssql_usr, mssql_pwd);
$sql = "UPDATE Customer SET n=".$amount."...
if ($result = odbc_exec($conn, $sql)) {
odbc_close($conn);
return 1;
}
Another function save a 'log' in db
function mvm_saveHistory
$conn = odbc_connect(mssql_dsn, mssql_usr, mssql_pwd);
$sql = "insert into log ...
if ($result = odbc_exec($conn, $sql)) {
odbc_close($conn);
return 1;
}
If I call functions in this order all works fine (counter decreased by 1)
mvm_saveHistory
mvm_updateAvailableSms
If the order is
mvm_updateAvailableSms
mvm_saveHistory
The result in db is that the counter is decreased by 2
and If I add a new call
mvm_updateAvailableSms
mvm_saveHistory
mvm_saveHistory
The result is counter decreased by 3 and so on
Can you please help me?