Я пробовал, но безрезультатно. Я получил неопределенные $news.
Код: Выделить всё
public function get_all_news_home()
{
$news = array();
# ne conectam la baza de date
$this->load->database();
# selectam stirile de top
$last_news_query = $this->db->query("SELECT * FROM News WHERE Type = 1 AND Ready='Y' ORDER BY Date DESC LIMIT 4");
$last_news = $this->db->query($last_news_query);
$last_news = ($last_news->num_rows()) ? $last_news->result_array() : NULL;
foreach ($last_news as $ln)
{
array_push($news,array('id' => $ln['ID']));
}
$all_news = $this->db->query("SELECT * FROM News WHERE News.Ready = 'Y' AND News.ID NOT IN ('$news') ORDER BY Date DESC LIMIT 12");
if($all_news->num_rows())
{
$all_news = $all_news->result_array();
}
else
{
$all_news = NULL;
}
return $all_news;
}
Подробнее здесь: https://stackoverflow.com/questions/232 ... uerys-resu