$retour['resultat'] .= '<tr><th rowspan="2">' . $tab_jour[$i] . '</th>'; $timestampJour = strtotime('+' . $i . ' day', $lundiSemaine); $premiereLigne = true; foreach ($typeRepas as $type) { if (!$premiereLigne) { $retour['resultat'] .= '<tr>'; } $retour['resultat'] .= '<th>' . $type . '</th>'; $requete = new requete(); $requete->select(array('calendrier' => 'id'), 'c'); $requete->where(array('c' => array('jour' => date('d', $timestampJour), 'mois' => date('m', $timestampJour), 'annee' => date('Y', $timestampJour), 'typeCalendrier' => $type))); // echo $requete->requete_complete().'<br><br>'; $requete->grand_tableau = false; $requete->executer_requete(); $result = $requete->resultat; $requete->reset(); if ($result) { foreach ($liste as $regime) { $requete->alias = true; $requete->select('menu_regime', 'mr'); $requete->select('menu', 'm'); $requete->select(array('menu_entree' => 'nom'), 'me'); $requete->select(array('menu_viande' => 'nom'), 'mv'); $requete->select(array('menu_legume' => 'nom'), 'ml'); $requete->select(array('menu_fromage' => 'nom'), 'mf'); $requete->select(array('menu_dessert' => 'nom'), 'md'); $requete->where(array('mr' => array('idCalendrier' => $result['c.id'], 'idRegime' => $regime['id']))); // echo $requete->requete_complete().'<br><br>'; $requete->grand_tableau = false; $requete->executer_requete(); $resultat = $requete->resultat;