[eluser]Otemu[/eluser]
Hi,
Hope everyone well, hoping someone could help me with this.......
Basically I have a call that returning an multidimensional array from my database, which I use to display 4 featured stories, I then have more stories displayed in a list which shouldn't include what is already in the featured stories.
How can I extract only the articleid from this multidimensional array into a variable, so that I can then pass this variable into my next query?
Controller
Code:
$promoList4['promoList'] = $this->M_Modules->getPromoList4();
Model
Code:
function getPromoList4() {
$data = array();
$this->db->select('modules.moduleid, modules.articleid, modules.module_name, modules.display, articles.articleid, articles.heading, articles.intro_text, articles.page_url, articles.summary_text, articles.display, images.articleid, images.smallurl, images.largeurl, images.description');
$this->db->from('modules','articles','images');
$this->db->join('articles', 'modules.articleid = articles.articleid','left');
$this->db->join('images', 'articles.articleid = images.articleid','left');
$this->db->where('modules.display', 1);
$this->db->where('articles.template', 'default_article');
$this->db->limit(4);
$Q = $this->db->get();
$Q->num_rows();
if ($Q-> num_rows() > 0){
foreach ($Q-> result_array() as $row){
$data[] = $row;
}
}
$Q->free_result();
return $data;
}
All my attempts have failed so far :red:
I was going to create another db query just to rerun the ids but thought this wouldn't be good practice since I already have the data. Any tips or advice will be appreciated.
Thanks All