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
| <?php
if(isset($_POST['centre']) AND isset($_POST['faisceau']))
{
$centre=$_POST['centre'];
$nom_faisceau=$_POST['faisceau'];
}
// Maintenant on affiche tous les faisceaux du centre selectionné
// On se connecte d'abord à MySQL :
mysql_connect("localhost", "root", "root");
mysql_select_db("appli");
// On utilise la requête suivante pour récupérer les infos sur le faisceau correspondant
$reponse = mysql_query("SELECT Nom_Faisceau, Designation, Point_Code, Type_Faisceau, Type_Reseau, Genre FROM faisceau WHERE (nom_faisceau= '$nom_faisceau') OR (centre_id = '$centre') ORDER BY NOM_FAISCEAU" ) or die (mysql_error());
// On se déconnecte de MySQL
mysql_close();
?>
<div id="voir">
<?php echo'<table border="1"><tr>';
for ($i = 0; $i < mysql_num_fields($reponse); $i++) {
echo '<th>';
echo mysql_field_name($reponse, $i);
echo '</th>';
}
echo '</tr>';
while ($row = mysql_fetch_row($reponse)) {
echo '<tr>';
for ($j = 0; $j < count($row); $j++) {
echo '<td>';
echo ($row[$j] == NULL) ? '<i>NULL</i>' : $row[$j];
echo '</td>';
}
echo '</tr>';
}
?> |