Hello,
I have a MyISAM table:

CREATE TABLE `dlr` (
  `msisdn` varchar(20) NOT NULL default '',
  `source` varchar(20) NOT NULL default '',
  `operator_id` varchar(20) NOT NULL default '',
  `sms_message` longtext NOT NULL,
  `smsc_id` varchar(20) NOT NULL default '',
  `sms_id` varchar(250) NOT NULL default '',
  `dlr_smsc` text NOT NULL,
  `dlr` tinyint(4) NOT NULL default '0',
  `date_time` datetime NOT NULL default '0000-00-00 00:00:00'
) TYPE=MyISAM

I have a case here, on July 7 I imported some data into the table with this 
query:

INSERT INTO dlr (source, msisdn, operator_id, sms_message, smsc_id, sms_id, 
dlr_smsc, dlr, date_time) 
VALUES 
('366508', '1234', 4, '', 'IM33665', MD5(RAND()), 'RE:', '2', NOW()),
('366508', '1234', 4, 'id:0943381383 sub:001 dlvrd:000 submit date:0606280317 
done date:0606290317 stat:EXPIRED err:999 text:xxxx, 'IM33665', MD5(RAND()), 
'RE:id:0943381383 sub:001 dlvrd:000 submit date:0606280317 done date:0606290317 
stat:EXPIRED err:999 text:xxxx', '2', '2006-06-28 03:17:00'),
('366508', '1234', 4, 'id:1226442088 sub:001 dlvrd:000 submit date:0606280317 
done date:0606290317 stat:EXPIRED err:999 text:xxxx', 'IM33665', MD5(RAND()), 
'RE:id:1226442088 sub:001 dlvrd:000 submit date:0606280317 done date:0606290317 
stat:EXPIRED err:999 text:Silahkan tawar: XDA ', '2', '2006-06-28 03:17:00'),
('366508', '1234', 4, 'id:1861980498 sub:001 dlvrd:000 submit date:0606280317 
done date:0606290317 stat:EXPIRED err:999 text:xxxx', 'IM33665', MD5(RAND()), 
'RE:id:1861980498 sub:001 dlvrd:000 submit date:0606280317 done date:0606290317 
stat:EXPIRED err:999 text:xxxx', '2', '2006-06-28 03:17:00'),
('366508', '1234', 4, '', 'IM33665', MD5(RAND()), 'RE:', '2', NOW()).......

And when I try to fetch the data using PHP with this query:

SELECT operator_id, DATE_FORMAT(date_time,'%d-%m-%Y') AS tanggal, COUNT(*) AS 
TOTAL FROM dlr WHERE 1=1 AND dlr = 8 AND MONTH(date_time) = MONTH(NOW()) GROUP 
BY tanggal, operator_id ORDER BY date_time

The weird thing happened. Why does all the rows are shown or treated as July 
7th data? If we see the imported data, there should be June 28, June 
29.....until July 7. Please help and many thanks for any reply.

Regards


Willy

Reply via email to