1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| <?php
$sql = new mysqli('localhost', 'user', 'pass', 'db');
if (mysqli_connect_errno()) exit('Echec :'.mysqli_connect_error());
// ON RECUPERE LA LISTE DES PROJETS
settype($projets, 'array');
$req = 'SELECT id, projet FROM projets ORDER BY projet';
if ($res = $sql->query($req))
while (list($id, $projet) = $res->fetch_row()) $projets[$id] = $projet;
$res->close();
// ON RECUPERE LA LISTE DES PERSONNES
settype($personnes, 'array');
$req = 'SELECT id, personne FROM personnes ORDER BY personne';
if ($res = $sql->query($req))
while (list($id, $personne) = $res->fetch_row()) $personnes[$id] = $personne;
$res->close();
$sql->close();
settype($auteurs, 'array');
foreach ($personnes as $personne)
foreach ($projets as $projet)
$auteurs[$projet] = $personnes;
echo '<pre>';
print_r($auteurs);
echo '</pre>';
?> |
Partager