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

Following used to work in 1.5.x

$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:
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.

$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.

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.


Theme © iAndrew 2016 - Forum software by © MyBB