mysql - PHP Best Practice to Update one record and delete another record -
i have 2 tables ( voucher , voucherbalance ). intention first check whether if voucher exist(assuming voucher exists), it'll deleted table , update record in table.
following approach im doing.
$vouchercode=$_request['vouchercode']; $userid=$_request['userid']; $vouchervalue = $link->query("select vouchervalue voucher vouchercode='$vouchercode';"); $link->query("delete voucher vouchercode='$vouchercode';"); $result = $link->query("update uservoucherbalance set voucherbalance=voucherbalance+'$intvouchervalue' userid='$userid';");
i ask there better approaches ? best practice ?
Comments
Post a Comment