I want to display 30 rows from an data base,on an TABLE, but just the approved entries. This "approved entries" are defined for an row with values "1 for approved" and "0 for NOT approved"
This is the code wath I need to change:
<?php
$servername = "localhost";
$username = "username ";
$password = "password";
$dbname = "name";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT id, label, title_id, season, episode, approved FROM links order by id desc LIMIT 30 OFFSET 1";
$result = $last_id = $conn->query($sql);
if ($result->num_rows > 0)
{
echo "<table><tr><th>ID</th><th>Audio</th><th>URL</th><th>Temporada</th><th>Episodio</th><th>Aprobado</th></tr>";
// output data of each row
while($row = $result->fetch_assoc()) {
echo "<tr><td>".$row["id"]."</td><td>".$row["label"]."</td>";
echo "<td><a href=";
if (empty($row['episode'])) {
echo '/peliculas-online/'.$row["title_id"];
}
else {
echo '/series-online/'.$row['title_id'].'/seasons/'.$row['season'].'/episodes/'.$row["episode"];
}
echo ">".$row["title_id"]."</a></td>";
echo "<td>".$row["season"]."</td><td>".$row["episode"]."</td><td>".$row["approved"]."</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
$conn->close();
?>
Like you can see, this code list all (approved or not)... how to get something like this:
if row approved=1 display rows, else hide (hide all not just the approved row)
Need to HIDE all entries from this table row if entry is not approved -> id-label-title_id-season-episode-approved
Thanks
Aucun commentaire:
Enregistrer un commentaire