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
| <html>
<head>
<title>Recherche</title>
<STYLE TYPE="text/css">
tr.c1{background-color:#FF00FF;}
tr.c2{background-color:#DDA0DD;}
</style>
</HEAD>
<body>
<font color=orange><h3 align=center><u>Résultat</u></h3></font>
<hr>
<CENTER>
<table border=1>
<tr>
<th>Nom</th>
<th>Prenom</th>
<th>CNE</th>
<th>Age</th>
<th>Moyenne</th>
</tr>
<?
if (mysql_connect("localhost","root","")>0)
echo"";
else echo "connexion impossible ";
if(mysql_select_db("ensas")==true)
echo "<br> ";
else "selection de la base impossible ";
$choix1=$_POST['choix1'];
$choix2=$_POST['choix2'];
$valeur=$_POST['valeur'];
$requete="SELECT * FROM g_info WHERE Age<23";
$result=mysql_query($requete);
if (mysql_num_rows($result)>0)
{
$i=0;
$tabStyle[0]="c1";
$tabStyle[1]="c2";
// ouverture initiale
if(!($handle = fopen("resultatSQL.txt", "w+")))
{
echo "Ecriture Impossible !";
die();
}
while($enreg=mysql_fetch_array($result))
{
echo '<tr class="'.$tabStyle[++$i%2].'">';
echo '<td>'.$enreg['NOM'].'</td>';
echo '<td>'.$enreg['PRENOM'].'</td>';
echo '<td>'.$enreg['CNE'].'</td>';
echo '<td>'.$enreg['Age'].'</td>';
echo '<td>'.$enreg['Moyenne'].'</td>';
echo '</tr>';
// écriture incrémentée
for($i = 0; $i < count($enreg); $i++)
fwrite($handle, $enreg[$i] . " | ");
fwrite($handle, "\n");
}
// fermeture finale
fclose($handle);
}
?>
</table>
</center>
</body>
</html> |
Partager