如果总和(金额)大于25000,则在php中引发错误,否则将其插入数据库mysql中

时间:2015-03-10 06:01:52

标签: php mysql sql

$dupesql = "SELECT * FROM `transfer` WHERE 25000>=(select sum(amount) from transfer WHERE acc_no='$acc_no1') AND acc_no='$acc_no1' AND agent_id='$agent_id'";

echo "SELECT * FROM `transfer` WHERE 25000>=(select sum(amount) from transfer WHERE acc_no='$acc_no1') AND acc_no='$acc_no1' AND agent_id='$agent_id'";

$duperaw = mysql_query($dupesql);

if (mysql_num_rows($duperaw) > 0) {
   $sql = mysql_query("INSERT INTO `transfer`(`t_id`, `agent_id`, `agent_name`, `date`, `name`, `phone`, `email`, `tname`, `tphone`, `temail`, `acc_no`, `bank`, `branch`, `code`, `amount`, `comment`, `status`) VALUES (NULL,'$agent_id','$agent_name','$date','$name','$phone','$email','$tname','$tphone','$temail','$accno','$bank','$branch','$code','$amt','$cmmnt','$status')");

echo '<script language="javascript">alert("Your Order has been Received \n You will be Notified via SMS/Email when the money is Transfered");window.location="../my.php"</script>';     

0 个答案:

没有答案