Bastien
06-08-2015, 08:25 PM
One problem corrected, so here is a new one :D
This is my table devis_fournisseurs :
https://vborg.vbsupport.ru/external/2015/06/19.png (http://www.servimg.com/view/14591051/692)
I'd like to display the content like this : Category | subcategories, so like this :
1 1.1 1.2 1.3
2 2.1 2.2
3
but my code always displays :
https://vborg.vbsupport.ru/external/2015/06/20.png (http://www.servimg.com/view/14591051/693):confused:
Why ?
$item='<table border=\"0\">';
$listes_parents = $vbulletin->db->query_read("
SELECT *
FROM devis_produits
WHERE est_parent = 1
ORDER by id_affichage
");
while ($liste_parent = $vbulletin->db->fetch_array($listes_parents))
{
$item .= "<tr><td>$liste_parent[nom]</td><td>";
$id = $liste_parent[id];
$listes_enfants = $vbulletin->db->query_read("
SELECT *
FROM devis_produits
WHERE enfant_de = '. $id .'
ORDER by id_affichage
");
while ($liste_enfant = $vbulletin->db->fetch_array($listes_enfants))
{
$item .= "$liste_enfant[nom] ";
}
$vbulletin->db->free_result($listes_enfants);
$item .='</tr>';
}
$item .='</table>';
$vbulletin->db->free_result($listes_parents);
This is my table devis_fournisseurs :
https://vborg.vbsupport.ru/external/2015/06/19.png (http://www.servimg.com/view/14591051/692)
I'd like to display the content like this : Category | subcategories, so like this :
1 1.1 1.2 1.3
2 2.1 2.2
3
but my code always displays :
https://vborg.vbsupport.ru/external/2015/06/20.png (http://www.servimg.com/view/14591051/693):confused:
Why ?
$item='<table border=\"0\">';
$listes_parents = $vbulletin->db->query_read("
SELECT *
FROM devis_produits
WHERE est_parent = 1
ORDER by id_affichage
");
while ($liste_parent = $vbulletin->db->fetch_array($listes_parents))
{
$item .= "<tr><td>$liste_parent[nom]</td><td>";
$id = $liste_parent[id];
$listes_enfants = $vbulletin->db->query_read("
SELECT *
FROM devis_produits
WHERE enfant_de = '. $id .'
ORDER by id_affichage
");
while ($liste_enfant = $vbulletin->db->fetch_array($listes_enfants))
{
$item .= "$liste_enfant[nom] ";
}
$vbulletin->db->free_result($listes_enfants);
$item .='</tr>';
}
$item .='</table>';
$vbulletin->db->free_result($listes_parents);