Code : Tout sélectionner
<?php
session_start();
//Connexion à la BDD.
include ('conf.php');
include ('themes/'.$theme.'/header.php');
function String2Stars($string='',$first=0,$last=0,$rep='*'){
$begin = substr($string,0,$first);
$middle = str_repeat($rep,strlen(substr($string,$first,$last)));
$end = substr($string,$last);
$stars = $begin.$middle.$end;
return $stars;
}
?>
<h1> Latest's Payment's</h1>
<table class='table table-bordered table-striped' border="1" align="center">
<tr>
<th>Nickname</th>
<th>Amount</th>
<th>Andress</th>
<th>Date</th>
</tr>
<?php
$servername = "locahostl";
$username = "db_user";
$password = "db_pass";
$dbname = "db_bame";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM 11_payout ORDER BY paid DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["login"].
"</td><td>".$row["amount"].
"</td><td>".String2Stars($row["payac"],0,5).
"</td><td>".$row["paid"]."</td></tr>";
}
}
else
{
echo "0 results";
}
$conn->close();
?>
</table>
<?php
include ('themes/'.$theme.'/footer.php');
?>