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
   | <html>
	<?php
		$PARAM_hote='localhost';
		$PARAM_port='8888';
		$PARAM_nom_bd='repertoire';
		$PARAM_utilisateur='user';
		$PARAM_mot_passe='login';
		try{
			$connexion = new PDO('mysql:host='.$PARAM_hote.';dbname='.$PARAM_nom_bd, $PARAM_utilisateur, $PARAM_mot_passe);
			$connexion->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
			}
		catch(Exception $e)
		 {
		  die('Erreur : '.$e->getMessage());
		 }
	?>
	<head>
		<title>Repertoire</title>
		<link rel="stylesheet" media="screen" type="text/css" title="recherche_2" href="cible_recherche.css" />
	</head>
	<body>
		<div id="en_tete">
			<h1>Repertoire de LogicSystems</h1>
		</div>
		<div id="menu">        
			<div class="element_menu">
				<h3>Menu</h3>
				<ul>
					<li><a href="formulaire_recherche.php">Recherche</a></li>
					<li><a href="formulaire_alphabetique.php">Répertoire par ordre Alphabétique</a></li>
				</ul>
			</div>        
		</div>
		<div id="corps">
			<?php
 
				//calculs reslutats et nombres resultats
 
				$recherche = $_POST['var1'];
				$sql = $connexion->prepare("SELECT * FROM Contacts WHERE nom = ? OR prenom = ? OR adresse = ? OR ville = ? OR code_postal = ? OR telephone_fixe = ? OR telephone_port = ? OR fax = ?");
				$sql->execute(array($recherche, $recherche, $recherche, $recherche, $recherche, $recherche, $recherche, $recherche,)) or die(print_r($sql->errorInfo())); 
				$donnees = $sql->fetch();
				$sql_count = 'SELECT COUNT(*) AS nbUsers FROM contacts WHERE nom = ? OR prenom = ? OR adresse = ? OR ville = ? OR code_postal = ? OR telephone_fixe = ? OR telephone_port = ? OR fax = ?';  
				$resultat = $connexion->prepare($sql_count); 
				$resultat->execute(array($recherche, $recherche, $recherche, $recherche, $recherche, $recherche, $recherche, $recherche,)); 
				$resultat = $resultat->fetchColumn(); 
 
				//Affichage nombre de resultat
 
				If($resultat == 1) {
				echo "Il y a $resultat resultat"; 
				}
				Elseif ($resultat == 0){
				echo "Il n'y a pas de resultat";
				}
				Else{
				echo "Il y a $resultat resultats";
				}
 
				//affichage resultats
 
				If ($resultat == 0){
				}
				else {
				}
			?>
			<table class="contacts">
				<tr>
					<th class="colonne_nom">Nom</th>
					<th class="colonne_prenom">Prénom</th>
					<th class="colonne_adresse">Adresse</th>
					<th class="colonne_cp">Code Postal</th>
					<th class="colonne_ville">Ville</th>
					<th class="colonne_port">Numéro Portable</th>								
					<th class="colonne_fixe">Numéro Fixe</th>
					<th class="colonne_fax">Fax</th>
				</tr>
				<p>Resultat de la recherche "<?php echo "$recherche" ?>" :</p>
				<?php
					for($i=1; $i<=$resultat; $i++){
				?>
							<p>
							<tr>
								<td><?php echo $donnees['nom']; ?></td>
								<td><?php echo $donnees['prenom']; ?></td> 
								<td><?php echo $donnees['adresse'] ;?></td>
								<td><?php echo $donnees['code_postal']; ?></td>
								<td><?php echo $donnees['ville']; ?></td>
								<td><?php echo $donnees['telephone_port']; ?></td> 
								<td><?php echo $donnees['telephone_fixe'];?></td> 
								<td><?php echo $donnees['fax']; ?></td> 
							</tr>
						</p>
						<?php 
						$donnees = $sql->fetch();
					}
						?>
			</table>
		</div>
		<div id="pied_de_page">
			<p>Copyright "LogicSystems Corporation" 2005, tous droits réservés</p>
		</div>
	</body>
</html> | 
Partager