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 - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -