Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="it">
- <body>
- <section style="padding: 5%; background-color: rgb(245, 245, 245)">
- <div class="container">
- <h1 style="text-align: center; font-weight: bold">Eventi In Programma</h1>
- <h4 style="text-align: center; padding-bottom: 5%" >prenota subito il tuo posto a tavola!</h4>
- <div class="card-deck">
- <div id="demo" class="row">
- <?php
- include("./db/mysql_credentials.php");
- $numCards = 9;
- $cMax = $numCards;
- $cMin = 0;
- $cMinTmp = $cMin;
- $cMaxTmp = $cMax; //inutile
- $skip = $cMax - $numCards;
- $conn = new mysqli($mysql_server, $mysql_user, $mysql_pass, $mysql_db);
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $query = "SELECT * FROM events ORDER BY date";
- $result = $conn->query($query);
- if ($result->num_rows > 0) {
- while($cMin!=$cMax){
- //while($row = $result->fetch_assoc()){
- if($row = $result->fetch_assoc()){
- if($skip == $cMinTmp){
- echo
- '<div class="col-sm-4" style="padding: 2%">
- <div class="card">
- <img class="card-img-top" src='.$row["img"].' alt="Card image cap">
- <div class="card-body">
- <h5 class="card-title">'.$row["title"].'</h5>
- <p class="card-text">'.$row["description"].'</p>
- <p class="card-text">
- <small class="text-muted">'.$row["date"].'</small>
- </p>
- </div>
- </div>
- </div>';
- } else $skip--;
- }
- $cMin++;
- };
- $cMin=$cMinTmp;
- } else {
- echo "<h5>Non ci sono Eventi in programma</h5>";
- }
- $conn->close();
- ?>
- </div>
- </div>
- <div id="demo" class="row" style="padding:2%;">
- <button type="button" id="btnPrec" onclick="" class="btn btn-outline-secondary col-sm-2 offset-sm-4"> << </button>
- <button type="button" id="btnNext" onclick="" class="btn btn-outline-secondary col-sm-2 "> >> </button>
- </div>
- </div>
- </section>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement