@nettulf: theres a column name read (TINYINT(1)) default val 0, when i add this at line 2 it throws an error saying [Trying to get property of non-object]. and i dont dont know why? the code bellow is working as intended. so that read column was creating problem after i sort it out. any idea what may be the problem?
1. parent::query("
2. SELECT msg_id,acc_id,msg_to_id,date,type,status,spam,attc,body FROM (
3. SELECT
4. m.acc_id,m.msg_to_id,m.date as date,m.type,m.status,m.read,m.spam,m.attc,
5. b.msg_id,b.body
6. FROM eb_msg m
7. INNER JOIN eb_msg_body b on m.msg_id = b.msg_id
8. WHERE m.acc_id = '$acc_id' AND m.msg_to_id = '$str2' {$jdate}
9. ORDER BY m.date DESC ". $querylimit ."
10. ) AS x ORDER BY x.date ASC
11. ");
heres the table structure:
CREATE TABLE `eb_portal`.`eb_msg` (
`msg_id` int(11) NOT NULL,
`acc_id` int(11) NOT NULL,
`msg_to_id` int(11) NOT NULL,
`date` int(10) DEFAULT NULL,
`type` tinyint(1) DEFAULT '0' COMMENT '1=blocked',
`status` tinyint(1) DEFAULT '0' COMMENT '1=replied',
`read` tinyint(1) DEFAULT '0' COMMENT '1=read',
`spam` tinyint(1) DEFAULT '0' COMMENT '1=spam',
`attc` tinyint(1) DEFAULT '0' COMMENT '0=no attc',
PRIMARY KEY (`msg_id`),
KEY `acc_id` (`acc_id`),
KEY `msg_to_id` (`msg_to_id`),
KEY `date` (`date`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC;