<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<?php
$host = 'localhost';
$dbname = 'gispe';
$username = 'root';
$password = '';
$dsn = "mysql:host=$host;dbname=$dbname";
if (isset($_POST['envoyer']))
{
$designation = stripslashes($_REQUEST['designation']);
$type = stripslashes($_REQUEST['type']);
if($type==='consommable')
{
$sql = "SELECT * FROM consommable where designation = '$designation' ";
//$nombreResultatRequete = count($sql);
}
if($type==='materiels')
{
$sql = "SELECT * FROM materiels where designation = '$designation' ";
//$nombreResultatRequete = count($sql);
}
if($type==='equipement')
{
$sql = "SELECT * FROM equipement where designation = '$designation' ";
//$nombreResultatRequete = count($sql);
}
try{
$pdo = new PDO($dsn, $username, $password);
$stmt = $pdo->query($sql);
if($stmt === False)
{
die("Erreur ");
}
}catch (PDOException $e){
echo $e->getMessage();
}
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1><center><font color="red"></font> <u> Resultat(s) correspondant a votre recherche</u></center></h1>
<table align="center" border="1">
<thead>
<tr>
<th><font size="+2">Identifiant</font></th>
<th><font size="+2">Reference</font></th>
<th><font size="+2">Type</font></th>
<th><font size="+2">Designation</font></th>
<th><font size="+2">Numero de serie</font></th>
<th><font size="+2">Etat</font></th>
<th><font size="+2">Quantite</font></th>
<th><font size="+2">Date</font></th>
<th></th>
</tr>
</thead>
<tbody>
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) : ?>
<tr>
<td align="center"><?php echo htmlspecialchars($row['identifiant']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['reference']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['type']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['designation']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['numero_serie']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['etat']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['quantite']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['date']); ?></td>
<td align="center"><a href="modifier1.php"> modifier </a> </td>
<td align="center"><a href="supprimer.php"> supprimer </a> </td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</body>
</html>
<html>
<head>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<?php
$host = 'localhost';
$dbname = 'gispe';
$username = 'root';
$password = '';
$dsn = "mysql:host=$host;dbname=$dbname";
if (isset($_POST['envoyer']))
{
$designation = stripslashes($_REQUEST['designation']);
$type = stripslashes($_REQUEST['type']);
if($type==='consommable')
{
$sql = "SELECT * FROM consommable where designation = '$designation' ";
//$nombreResultatRequete = count($sql);
}
if($type==='materiels')
{
$sql = "SELECT * FROM materiels where designation = '$designation' ";
//$nombreResultatRequete = count($sql);
}
if($type==='equipement')
{
$sql = "SELECT * FROM equipement where designation = '$designation' ";
//$nombreResultatRequete = count($sql);
}
try{
$pdo = new PDO($dsn, $username, $password);
$stmt = $pdo->query($sql);
if($stmt === False)
{
die("Erreur ");
}
}catch (PDOException $e){
echo $e->getMessage();
}
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1><center><font color="red"></font> <u> Resultat(s) correspondant a votre recherche</u></center></h1>
<table align="center" border="1">
<thead>
<tr>
<th><font size="+2">Identifiant</font></th>
<th><font size="+2">Reference</font></th>
<th><font size="+2">Type</font></th>
<th><font size="+2">Designation</font></th>
<th><font size="+2">Numero de serie</font></th>
<th><font size="+2">Etat</font></th>
<th><font size="+2">Quantite</font></th>
<th><font size="+2">Date</font></th>
<th></th>
</tr>
</thead>
<tbody>
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) : ?>
<tr>
<td align="center"><?php echo htmlspecialchars($row['identifiant']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['reference']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['type']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['designation']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['numero_serie']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['etat']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['quantite']); ?></td>
<td align="center"><?php echo htmlspecialchars($row['date']); ?></td>
<td align="center"><a href="modifier1.php"> modifier </a> </td>
<td align="center"><a href="supprimer.php"> supprimer </a> </td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</body>
</html>