Hi there,
As you may guess from topic title I have got 2 tables : (let's say) posts and post_images.
POSTS TABLE consists of:
post_id - posts_name - post_text - post_date
POST_IMAGES consists of:
post_image_id - post_id - post_url
And on my admin panel I have got a page which lists posts as a table (as a result of
this Model and
Controller).
Model:
PHP Code:
function my_posts(){
$mp = $this->db->SELECT('*')
->from('posts')
->get()
->result();
return $mp;
}
Controller:
PHP Code:
public function posts(){
$this->load->model('Backend_model');
$data['posts'] = $this->Backend_model->my_posts();
$this->load->view('admin/posts', $data);
}
result page :
post_name - post_date - how-many-images-does-this-post-have
example1 01.12.2019 ??????
example2 02.12.2019 ??????
How can I get the image number of each blog post?
P.S. I have tried lots of examples on stackoverfow and here about joins-counts and grouping even, however as I couldn't succeed it, I am posting here as plain as possible
Thanks in advance