Redjik
Джедай-мастер
PHP:
if($url_arr[3]=='all')
{
$query = "select ID,DATE_FORMAT(TIMESTAMP, '%b %d %Y %H:%i:%s') as TIMESTAMP,coupons_users.userid,COUPONID,AMT,username,coupon_name,coupons_coupons.coupon_id as cid, CAPTURED,TRANSACTIONID,PAYMENTTYPE,CAPTURED_ACK from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid ";
if(!empty($searchkey)) {
$query .= " where coupons_users.username like '%".$searchkey."%' or coupons_coupons.coupon_name like '%".$searchkey."%'"; }
$query .= " order by TIMESTAMP desc";
}
else if($url_arr[3]=='success')
{
$query = "select ID,DATE_FORMAT(TIMESTAMP, '%b %d %Y %H:%i:%s') as TIMESTAMP,coupons_users.userid,COUPONID,AMT,username,coupon_name,coupons_coupons.coupon_id as cid, CAPTURED,TRANSACTIONID,TYPE,CAPTURED_ACK from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid ";
if(!empty($searchkey)) {
$query .= " where (coupons_users.username like '%".$searchkey."%' and transaction_details.CAPTURED='1') or (coupons_coupons.coupon_name like '%".$searchkey."%' and transaction_details.CAPTURED='1')" ; }
else{
$query .= " where transaction_details.CAPTURED='1' order by TIMESTAMP desc";
}
}
else if($url_arr[3]=='failed')
{
$query = "select ID,DATE_FORMAT(TIMESTAMP, '%b %d %Y %H:%i:%s') as TIMESTAMP,coupons_users.userid,COUPONID,AMT,username,coupon_name,coupons_coupons.coupon_id as cid, CAPTURED,TRANSACTIONID,TYPE,CAPTURED_ACK from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid ";
if(!empty($searchkey)) {
$query .= " where (coupons_users.username like '%".$searchkey."%' and transaction_details.CAPTURED='0') or (coupons_coupons.coupon_name like '%".$searchkey."%' and transaction_details.CAPTURED='0')" ; }
else{
$query .= " where transaction_details.CAPTURED='0' order by TIMESTAMP desc";
}
}
else if($url_arr[3]=='hold')
{
$query = "select ID,DATE_FORMAT(TIMESTAMP, '%b %d %Y %H:%i:%s') as TIMESTAMP,coupons_users.userid,COUPONID,AMT,username,coupon_name,coupons_coupons.coupon_id as cid, CAPTURED,TRANSACTIONID,TYPE,CAPTURED_ACK from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid ";
if(!empty($searchkey)) {
$query .= " where (coupons_users.username like '%".$searchkey."%' and transaction_details.CAPTURED='0' and transaction_details.CAPTURED='0') or (coupons_coupons.coupon_name like '%".$searchkey."%' and transaction_details.CAPTURED_ACK='' and transaction_details.CAPTURED='0')" ; }
else{
$query .= " where transaction_details.CAPTURED_ACK='' and transaction_details.CAPTURED='0' order by TIMESTAMP desc";
}
}
PHP:
if($url_arr[3]=='all')
{
$query = "select SUM(AMT) as total_amount from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid ";
if(!empty($searchkey)) {
$query .= "where (coupons_users.username like '%".$searchkey."%' or coupons_coupons.coupon_name like '%".$searchkey."%')"; }
}
else if($url_arr[3]=='success')
{
$query = "select SUM(AMT) as total_amount from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid where transaction_details.CAPTURED='1' ";
if(!empty($searchkey)) {
$query .= "and (coupons_users.username like '%".$searchkey."%' or coupons_coupons.coupon_name like '%".$searchkey."%')"; }
}
else if($url_arr[3]=='failed')
{
$query = "select SUM(AMT) as total_amount from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid where transaction_details.CAPTURED='0' ";
if(!empty($searchkey)) {
$query .= "and (coupons_users.username like '%".$searchkey."%' or coupons_coupons.coupon_name like '%".$searchkey."%')"; }
}
else if($url_arr[3]=='hold')
{
$query = "select SUM(AMT) as total_amount from transaction_details left join coupons_coupons on transaction_details.COUPONID = coupons_coupons.coupon_id left join coupons_users on transaction_details.USERID = coupons_users.userid where transaction_details.CAPTURED_ACK='' and transaction_details.CAPTURED='0' ";
if(!empty($searchkey)) {
$query .= "and (coupons_users.username like '%".$searchkey."%' or coupons_coupons.coupon_name like '%".$searchkey."%')"; }
}