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

Popular posts from this blog

javascript - IndexedDB error: Uncaught DataCloneError: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned -

amazon web services - When using Cognito credentials with AWS in a browser (javascript), keep getting "missing credentials" error -

c# - How to set the datatextfield value instead of the value on a drop down list? -