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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
|
<html>
<title>Affichage Tableau</title>
<head>
<script type="text/javascript">
function fill_values(str)
{
document.getElementById("value_div").innerHTML='<b>Chargement en cours... Veuillez patienter</b>';
if (str=="")
{
document.getElementById("value_div").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp21=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp21=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp21.onreadystatechange=function()
{
if (xmlhttp21.readyState==4 && xmlhttp21.status==200)
{
document.getElementById("value_div").innerHTML=xmlhttp21.responseText;
}
}
xmlhttp21.open("GET","fill_values.php?colonne="+str,true);
xmlhttp21.send();
}
function fill_table(str,str1)
{
document.getElementById("table_div").innerHTML='<b>Chargement en cours... Veuillez patienter</b>';
if (str=="")
{
document.getElementById("table_div").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp22=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp22=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp22.onreadystatechange=function()
{
if (xmlhttp22.readyState==4 && xmlhttp22.status==200)
{
document.getElementById("table_div").innerHTML=xmlhttp22.responseText;
}
}
xmlhttp22.open("GET","fill_table.php?colonne="+str+"&valeur="+str1,true);
xmlhttp22.send();
}
</script>
</head>
<body>
<?php
//=========================================
// information pour la connection à la DB
//=========================================
$host = '1XX.XX.XXX.XX';
$user = '********';
$pass = '********';
$db = 'XXX';
//======================
// connection à la DB
//======================
$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() );
mysql_select_db($db) or die ('Erreur :'.mysql_error());
echo "<select name=\"col_name\" value=\"\" onchange=\"fill_values(this.value)\">";
echo "<option label=\"\" value=\"\"></option>";
$rows = mysql_query("describe suivi_omt_orne",$link);
while ($row = mysql_fetch_assoc($rows))
{
$col=$row['Field'];
echo "<option label=\"$col\" value=\"$col\"></option>";
}
echo "</select><br>";
echo "<div id=\"value_div\"></div><br>";
//=============================================================================
// requête SQL qui compte le nombre total d'enregistrement dans la table et qui
//récupère tous les enregistrements
//=============================================================================
$select = 'SELECT * FROM suivi_omt_orne ORDER BY poste_source ASC';
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$total = mysql_num_rows($result);
//===========================================
// si on a récupéré un résultat on l'affiche.
//===========================================
echo "<div id=\"table_div\">";
if($total) {
//==================
// debut du tableau
//==================
echo '<table bgcolor="#FFFFFF">'."\n";
//======================================================================
// première ligne on affiche les titres postes_sources et depart dans 2 colonnes
//======================================================================
echo '*Les Postes Sources sont affichés par ordre alphabétique / ' . "\n";
echo '*Nombre de postes: ' . $total;
echo '<tr>';
echo '<td bgcolor="#FFD700"><b><u>Poste Source</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Départ</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>N° GDO</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Commune</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Equipement à poser</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Nom de poste</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>N° affaire</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Chargé affaire</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>IPT</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Radio ou RTC</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Position affaire</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Blocage</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Commentaires</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Programme</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>MEX prévue</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>MEX réelle</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Mise en service</u></b></td>';
echo '<td bgcolor="#FFD700"><b><u>Modification schéma exploitation</u></b></td>';
echo '</tr>'."\n";
//=========================================================================
// lecture et affichage des résultats sur 2 colonnes, 1 résultat par ligne.
//=========================================================================
while($row = mysql_fetch_array($result)) {
echo '<tr>';
echo '<td bgcolor="#A9A9A9">'.$row["poste_source"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["depart"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["num_gdo_poste_a_equiper"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["commune"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["equipement_a_poser"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["nom_de_poste"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["num_affaire"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["charge_affaire"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["ipt"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["radio_ou_rtc"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["position_affaire"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["blocage"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["commentaires"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["prg"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["mex_prevue"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["mex_reelle"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["mise_en_service"].'</td>';
echo '<td bgcolor="#A9A9A9">'.$row["modification_schema_exploitation"].'</td>';
echo '</tr>'."\n";
}
echo '</table>'."\n";
//================
// fin du tableau.
//================
}
else {echo 'Pas d\'enregistrements dans cette table...';}
echo "</div>";
// on libère le résultat
mysql_free_result($result);
mysql_close($link);
?>
</body>
</html> |
Partager