SQL Query dont work in CI |
[eluser]codeDeveloper[/eluser]
Hello, Please, help me, why don't work this SQL query: Code: $this->db->query ('SELECT u.nick, f.fuin, count(o.time) as online FROM `icqdate_friends` as f JOIN `icqdate_users` as u ON u.uin=f.fuin LEFT JOIN `icqdate_online` as o ON f.fuin=o.uin and o.time > NOW() - INTERVAL 5 MINUTE WHERE f.uin=? group by f.fuin order by online', array(723640)); CodeIgniter writing: Quote:A Database Error Occurred P.S. If helping to rewrite the query to Active Record would be very grateful
[eluser]pistolPete[/eluser]
If you use query(), you must not use get() as well! Have a look at the userguide: http://ellislab.com/codeigniter/user-gui...eries.html
[eluser]obiron2[/eluser]
also, you need to group by u.nick and f.fuin if you are going to select both.
[eluser]codeDeveloper[/eluser]
Thank you, works. And as to put into Active Record? Suggest me? |
Welcome Guest, Not a member yet? Register Sign In |