The following query returns the records I need. But in addition to getting the records, I need to sum the total value of 'amount' based on the query.
I have tried the sum command, but can't get it to work.
$query = sprintf("SELECT SUM amount FROM cbacks WHERE card_type = 'visa' AND mid = '$mid' AND receive_date >= '$date1' AND receive_date <= '$date2' AND amount >= '$amt1' AND amount <= '$amt2'");
$rs = mysql_query($query, $connect_crm) or die(mysql_error());
$row = mysql_fetch_assoc($rs);