When the result exists it's not going to the if
condition, it will go to else
. In query result $num>0
I want an alert like "receipt number already exists".
$.post("acceptajax.php?confirm1="+confirm+'&receipt='+receipt+'&amount='+amount,function(result,status){
//$('#divsub'+confirm).html(data);
if(result == 'exist'){
alert('Receipt number Alerady Exit');
} else {
$('#accept_'+confirm).hide();
$('#unaccept_' +confirm).show();
}
});
acceptajax.php
:
$img_id=$_GET['confirm1'];
$receipt=$_GET['receipt'];
$receipt='HYD'.$receipt;
$amount=$_GET['amount'];
$sql=mysql_query("SELECT receipt FROM user WHERE receipt=$receipt");
$num=mysql_num_rows($sql);
if($num==0){
echo "suc";
} else {
echo "exist";
}