Hi
having problem with this:
here's my data:
No Name IC NO Issue Date Issue Time Issue By Type Price (RM)
4 Rio Ferdinand 841123155072 2010-02-02 11:17:20 neodize 50 5
3 John Terry 841123155071 2010-02-02 06:43:39 neodize 100 10
7 Cristiano Ronaldo 841123155070 2010-02-03 03:25:25 test 100 10
Here are my codes:
// Get values from form
$mydate1 = isset($REQUEST["begindate"]) ? $REQUEST["begindate"] : "";
$mydate2 = isset($REQUEST["enddate"]) ? $REQUEST["enddate"] : "";
This is my query:
$query = "SELECT type, SUM(price) FROM details WHERE issuedate BETWEEN '$mydate1' AND '$mydate2' ORDER BY type";
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($rows = mysql_fetch_array($result)){
echo "# Total ". $rows['type']. " = RM". $rows['SUM(price)'];
}
But the result came out like this:
Total 50 = RM25
Its suppose to come out like this:
Total 50 = RM5
Total 100 = RM20
As you can see im trying to select and display between dates
What seems to be the problem guys?