<?php require_once "PDO_connect.php";
$query="SELECT * FROM smartphone.abonnements";
try{
$prep = $bdd->prepare($query);
$prep->execute();
$resultats = $prep->fetchAll();
}catch(Exception $e){;
echo "Erreur ! ".$e->getMessage() ;
}
?>
<!DOCTYPE>
<html>
<head>
<script src="JqueryTable.js" type="text/javascript" ></script>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Abonnement</title>
<link rel="stylesheet" type="text/css" href="Bouton.css">
<link rel="stylesheet" type="text/css" href="Select.css">
<script type="text/javascript">
$(document).ready(function() {
var table = $('#example').DataTable();
$('#example tbody').on( 'click', 'tr', function () {
if ( $(this).hasClass('selected') ) {
$(this).removeClass('selected');
}
else {
table.$('tr.selected').removeClass('selected');
$(this).addClass('selected');
}
} );
$('#button').click( function () {
table.row('.selected').remove().draw( false );
} );
} );
</script>
</head>
<body>
<center>
<table id="example" class="dataTable" >
<thead>
<tr>
<th>Operateur</th>
<th>SIM</th>
<th>PUK</th>
<th>Num ligne</th>
<th>Volume</th>
<th>Statut abo</th>
</tr>
</thead><tbody>
<?php
echo "<br>";
if(!empty($resultats)){
foreach ($resultats as $row) {
echo "<tr>";
echo "<td data-name=\"Operateur\">".$row["Operateur"]."</td>";
echo "<td data-name=\"Num_SIM\">".$row["Num_SIM"]."</td>";
echo "<td data-name=\"PUK\">".$row["PUK"]."</td>";
echo "<td data-name=\"Num_ligne\">".$row["Num_ligne"]."</td>";
echo "<td data-name=\"Volume\">".$row["Volume"]."</td>";
echo "<td data-name=\"Statut_abo\">".$row["Statut_abo"]."</td>";
echo "</tr>";
}
}else {
echo "Pas d'enregistrements dans cette table...";
}
?>
</tbody></table></center>
</body>
</html>
<script src="http://code.jquery.com/jquery-1.8.0.min.js" type="text/javascript" ></script>