<?php
$zid=$_POST['zid'];
$userid=$_POST['userid'];
$money=$_POST['money'];php
$pdo=new PDO("mysql:host=127.0.0.1;dbname=1611d","root","root");
$pdo->beginTransaction();
$smth1=$pdo->exec("update pay set money=money-$money where id='$zid'");
$smth2=$pdo->exec("update pay set money=money+$money where id='$userid'");
$res=$pdo->query("select * from pay where id='$zid'")->fetch();mysql
$res1=$res['money'];
if($smth1>0&&$smth2>0){
$pdo->commit();
echo 1;
}else if($res1<$money){
$pdo->rollBack();
echo 2;
}else{
$pdo->rollBack();
echo 3;
}sql