Welcome Guest, Not a member yet? Register   Sign In
My view returns one row of a table in a strange way, no matter how many rows it has.
#1

[eluser]Unknown[/eluser]
Hi everybody,

New to Code Igniter, I try to display data from a table. My table has two lines, everything is properly returned to the Model or the Controller. But in the view, the table takes only the first line, and divided her into as many rows as columns ...

Here my work :

Code:
public function get_produit_categorie($categorie)
{
$query = $this->db->get_where('produit', array('Categorie_Produit' => $categorie));
return $query->row_array();
}

Code:
if ($categorie == '')
{
$data['produit'] = $this->Produit_Model->get_produit_mise_en_avant();
$data['Titre_Produit'] = 'Barzi Voyages';
}

$this->load->view('templates/header', $data);
$this->load->view('produit/'.$produit, $data);
$this->load->view('templates/footer', $data);

Code:
<?php foreach($produit as $leproduit): ?>

    <h2>&lt;?php echo $leproduit['Titre_Produit']; ?&gt;</h2>
    <div id="main">
        &lt;?php echo $leproduit['Description_Produit']; ?&gt;
    </div>
    <p><a href="produit/&lt;?php echo $leproduit['Slug_Produit']; ?&gt;">Voir l'article</a></p>

&lt;?php endforeach ?&gt;

The First row : 1,Vilamendhoo Island Resort,vilamendhoo-island-resort,Cette île est recouverte d’une forêt tropicale, bo...,route-d-europe,0

And that is what I see :
1
1

Voir l'article
V
V

Voir l'article
v
v

Voir l'article
C
C

Voir l'article
r
r

Voir l'article
0
0

Voir l'article

____

Any idea ? Thanks for helping !





Theme © iAndrew 2016 - Forum software by © MyBB