Welcome Guest, Not a member yet? Register   Sign In
Worked in 1.5 but gives error in 1.7.1
#1

[eluser]citryer[/eluser]
Following used to work in 1.5.x

Code:
//my_model.php
$this->db->select("id, DATE_FORMAT(postdt,'%D %M %Y') as newsdt, title");
$this->db->where('id',$id); // Confirmed value received
$query = $this->db->get('my_news_table');
return $query->row();

Since the upgrade to 1.7.x This now produces following error:
Code:
Fatal error: Call to a member function row() on a non-object in G:\wamp\XXX\YYY\models\my_model.php on line 48

Query by the way works when I remove the Date_Format portion from the select clause.
#2

[eluser]rogierb[/eluser]
try
Code:
$this->db->select("id, DATE_FORMAT(postdt,'%D %M %Y') as newsdt, title", FALSE);

Because it is probably due to backticks the query doesn't work.
#3

[eluser]citryer[/eluser]
You are absolutely correct...

Looked closely at the docs after your comments.

Quote:$this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.

appreciate your help.

Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB