rgb192
asked on
email is 5 hours behind, sms 0 hours behind: how to sort
I downloaded gmails and noticed the email time is 5 hours behind
my sms are in real time 0 hours behind
CREATE TABLE `email_doc` (
`id` int(11) NOT NULL auto_increment,
`unix_timestamp` bigint(20) default NULL,
`from_email` varchar(200) default NULL,
`from_name` varchar(200) default NULL,
`to_email` varchar(200) default NULL,
`to_name` varchar(200) default NULL,
`subject` varchar(400) default NULL,
`body` varchar(4000) default NULL,
`real_id` varchar(30) default NULL,
`checked` int(11) default NULL,
`me_description` varchar(9000) default NULL,
`client_description` varchar(4000) default NULL,
`sms_type` tinyint(4) default NULL,
`client_start` datetime default NULL,
`client_end` datetime default NULL,
`client_total` int(11) default NULL,
`me_start` datetime default NULL,
`me_end` datetime default NULL,
`me_total` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unix_timestamp` (`unix_timestamp`)
) ENGINE=MyISAM AUTO_INCREMENT=1758 DEFAULT CHARSET=utf8$$
select * from email_doc order by unix_timestamp
if email (real_id is not null), then the time is unix_timestamp +5 hours
$row->unix_timestamp+18000
is sms
real_id is null
$row->unix_timestamp
when I use php I see messages out of order
I want to order by time, not unix_timestamp
I think it would be best if I can sort using mysql query
my sms are in real time 0 hours behind
CREATE TABLE `email_doc` (
`id` int(11) NOT NULL auto_increment,
`unix_timestamp` bigint(20) default NULL,
`from_email` varchar(200) default NULL,
`from_name` varchar(200) default NULL,
`to_email` varchar(200) default NULL,
`to_name` varchar(200) default NULL,
`subject` varchar(400) default NULL,
`body` varchar(4000) default NULL,
`real_id` varchar(30) default NULL,
`checked` int(11) default NULL,
`me_description` varchar(9000) default NULL,
`client_description` varchar(4000) default NULL,
`sms_type` tinyint(4) default NULL,
`client_start` datetime default NULL,
`client_end` datetime default NULL,
`client_total` int(11) default NULL,
`me_start` datetime default NULL,
`me_end` datetime default NULL,
`me_total` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `unix_timestamp` (`unix_timestamp`)
) ENGINE=MyISAM AUTO_INCREMENT=1758 DEFAULT CHARSET=utf8$$
select * from email_doc order by unix_timestamp
if email (real_id is not null), then the time is unix_timestamp +5 hours
$row->unix_timestamp+18000
is sms
real_id is null
$row->unix_timestamp
when I use php I see messages out of order
echo $row->unix_timestamp;
if (!empty($row->real_id)){
echo'<br>'.date("M j, g:i A", $row->unix_timestamp+18000);
echo '<br>'.$row->subject;
}else{
echo'<br>'.date("M j, g:i A", $row->unix_timestamp);
}
I want to order by time, not unix_timestamp
I think it would be best if I can sort using mysql query
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks