[eluser]Kyle123[/eluser]
Yes to both I'm afraid, it's odd. I've tracked it down to a single field in the query. Having replaced the sproc with SQL, executing the following works:
Code:
public function get_newest() {
$sql = "select top 20
(rtrim(sender.actfirstname)+' '+rtrim(sender.actsurname)) as [from],
(rtrim(tot.actfirstname)+' '+rtrim(tot.actsurname)) as [sent],
convert(text,rntNote) as [note]
from tb_rntRepnote
inner join tb_actActor Sender
on sender.ActKeyactor = RntSendTo
inner join tb_actActor tot
on tot.actkeyactor = rntsentby
where rntCreatedwhen > '2013-01-02 18:55:00'
and rntclassification = 13
Order by rntCreatedWhen Desc";
$query = $this->db->query($sql);
return $query->result();
But this doesn't:
Code:
public function get_newest() {
$sql = "select top 20
(rtrim(sender.actfirstname)+' '+rtrim(sender.actsurname)) as [from],
(rtrim(tot.actfirstname)+' '+rtrim(tot.actsurname)) as [sent],
convert(text,rntNote) as [note],
rntCreatedwhen as createdWhen
from tb_rntRepnote
inner join tb_actActor Sender
on sender.ActKeyactor = RntSendTo
inner join tb_actActor tot
on tot.actkeyactor = rntsentby
where rntCreatedwhen > '2013-01-02 18:55:00'
and rntclassification = 13
Order by rntCreatedWhen Desc";
$query = $this->db->query($sql);
return $query->result();
rntCreatedwhen is a smalldatetime field.
substituting with the following works:
Code:
convert(datetime,rntCreatedwhen) as createdWhen
Which is fine now I understand it, but it still seems like odd behaviour to me - but having Googled smalldatetime and PHP - there are loads of hits and it appears to be quite a common issue.