[eluser]OES[/eluser]
Hi
I am having a problem with 1.7 select data with the * statement.
Model code.
Code:
function list_news()
{
$this->db->select('ci_news.*, ci_news_categories.name, ci_users.nick');
$this->db->join('ci_news_categories','ci_news_categories.categoryID = ci_news.categoryID', 'left');
$this->db->join('ci_users', 'ci_users.userID = ci_news.posterID', 'left');
$this->db->from('ci_news');
$this->db->order_by('publishDate', 'ASC');
$query = $this->db->get();
return $query->result_array();
}
Im getting an error.
Code:
Error Number: 1054
Unknown column 'ci_news.*' in 'field list'
SELECT `ci_news`.`*`, `ci_news_categories`.`name`, `ci_users`.`nick` FROM (`ci_news`) LEFT JOIN `ci_news_categories` ON `ci_news_categories`.`categoryID` = `ci_news`.`categoryID` LEFT JOIN `ci_users` ON `ci_users`.`userID` = `ci_news`.`posterID` ORDER BY `publishDate` ASC
If I edit ci_news to select just one item ie, ci_news.title it works ok. So the * is throwing the error.
To say unknown column ci_news is incorrect.
If I run a simple query.
Code:
function list_news()
{
$query = $this->db->get('ci_news');
return $query->result_array();
}
Getting correct results.
I have looked in bug tracker and cant see if this is a bug or not. But I have used this type of code on a number of CI projects with no issues.
Hope you can advise.