55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
// include Database connection file
|
|
include("db_connection.php");
|
|
|
|
// Design initial table header
|
|
$data = '<table class="table table-bordered table-striped">
|
|
<tr style="color: black;">
|
|
<th>No.</th>
|
|
<th>Bien ou service recherché</th>
|
|
<th>Acheteur</th>
|
|
<th>Clé publique</th>
|
|
<th>Prix en junes</th>
|
|
<th>Mise à jour</th>
|
|
<th>Suppression</th>
|
|
</tr>';
|
|
|
|
$query = "SELECT * FROM recherches";
|
|
|
|
if (!$result = mysqli_query($db,$query)) {
|
|
exit(mysqli_connect_error());
|
|
}
|
|
|
|
// if query results contains rows then fetch those rows
|
|
if(mysqli_num_rows($result) > 0)
|
|
{
|
|
$number = 1;
|
|
while($row = mysqli_fetch_assoc($result))
|
|
{
|
|
$data .= '<tr style="background:lightblue;color:black;">
|
|
<td>'.$number.'</td>
|
|
<td>'.$row['produit'].'</td>
|
|
<td>'.$row['vendeur'].'</td>
|
|
<td>'.$row['cle_pub'].'</td>
|
|
<td>'.$row['prix'].'</td>
|
|
<td>
|
|
<button onclick="GetRecherchesDetails('.$row['id'].')" class="btn btn-warning">Mettre à jour</button>
|
|
</td>
|
|
<td>
|
|
<button onclick="DeleteRecherches('.$row['id'].')" class="btn btn-danger">Supprimer</button>
|
|
</td>
|
|
</tr>';
|
|
$number++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// records now found
|
|
$data .= "<tr style='color:white;'><td colspan='6'>Pas d'enregistrement</td></tr>";
|
|
}
|
|
|
|
$data .= '</table>';
|
|
|
|
echo $data;
|
|
?>
|