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
|
<body link="blue" vlink="#006633" >
<p align="center" > <u> Gestion des documents </u><br> <br>
Recherche par <b> description </b> <br> <br>
<?php
$SAISIE=$_COOKIE["saisie"];
$CHAMP=explode(" ",$SAISIE);
$COMPTEUR_MOTS=count($CHAMP); echo "<br>";
?>
<?php
//REQUETE 2 AFFICHAGE DU COUNT
// on se connecte à MySQL
$db = mysql_connect('-', '-', ' ');
// on sélectionne la base
mysql_select_db('intranet',$db);
// on crée la requête SQL
$sql="SELECT count(*) FROM fichier WHERE description LIKE '%".$SAISIE."%'";
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$total = mysql_num_rows($req);
// on fait une boucle qui va faire un tour pour chaque enregistrement
while($data = mysql_fetch_array($req))
{
// on affiche les informations de l'enregistrement en cours
$COUNT=$data["count(*)"];
}
// on ferme la connexion à mysql
mysql_close();
echo "Pour la description du nom de fichier saisie : <b>".$SAISIE."</b> , vous avez <b>".$COUNT. "</b> résultat(s) dans le tableau ci dessous :" ."<br><br>" ;
?>
<table border="2" bgcolor="#339933" align="center" cellspacing="2" cellpadding="3" height="1%" width="79%">
<tr bgcolor="white">
<th>ID</th>
<th>Nom</th>
<th>Description</th>
<th>Date</th>
<th>Lien</th>
</tr>
<?php
//REQUETE 3 AFFICHAGE DES RESULTATS
// on se connecte à MySQL
$db = mysql_connect('-', '-', '');
// on sélectionne la base
mysql_select_db('intranet',$db);
// on crée la requête SQL
$sql="SELECT id_fichier,nom_fichier,description,date,lien_fichier FROM fichier WHERE description LIKE '%".$SAISIE."%'";
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
$total = mysql_num_rows($req);
// on fait une boucle qui va faire un tour pour chaque enregistrement
while($data = mysql_fetch_array($req))
{
// on affiche les informations de l'enregistrement en cours
echo '<tr bgcolor="white">';
echo '<td>'.$data["id_fichier"].'</td>';
echo '<td>'.$data["nom_fichier"].'</td>';
echo '<td>'.$data["description"].'</td>';
echo '<td>'.$data["date"].'</td>';
echo '<td> <a href="'.$data["lien_fichier"].'" > Telechargez! </a> </td>';
echo '</tr>';
}
// on ferme la connexion à mysql
mysql_close();
?>
</table>
<br> <br>
<a href="intranet2.php?page=AccueilZoneSec"style="text-decoration:none;color:red"
onMouseOver="window.status='';return true"> <b>Accueil</b></a>
<br>
 
</p>
</body>
</html> |
Partager