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

java - Unable to make sub reports with Jasper -

sql - The object name contains more than the maximum number of prefixes. The maximum is 2 -

Java Web Service Soap fault exception client -