php - How to show all the records where the companyid = $companyid -
i have page can show individual companies: http://kees.een-site-bouwen.nl/bedrijven/1
on page shows me company id=1. if @ 'tags' somewhere down page, can see 'drukwerk'.
i used joined table show tags each company. there more tags specific company, shows me 1 tag "drukwerk".
how can show tags company id 1?
i'm still new codeigniter maybe it's simple, it's worth asking here.
my model function tags:
function bedrijven_tags($idbedrijven) { $this->db->where('bedrijven.idbedrijven', $idbedrijven); $this->db->select('*'); $this->db->from('bedrijftags'); $this->db->join('tags', 'bedrijftags.idtags = tags.idtags'); $this->db->join('bedrijven', 'bedrijftags.idbedrijven = bedrijven.idbedrijven'); $query = $this->db->get(); $result = $query->result_array(); return $result; } my controller function pass views:
$data['query2'] = $this->bedrijven_model->bedrijven_tags($idbedrijven); my views showing tags:
<?php foreach($query2 $item2);?> <?= ($item2['tag']); ?></p> <?php endforeach; ?>
it seems views showing tags wrong, this:
<?php foreach($query2 $item2){ echo "<p>" . $item2['tag'] . "</p>" ; }; ?>
Comments
Post a Comment