Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="row">
- <!-- This is the set up of a basic gallery, your items must have the categories they belong to in a data-category
- attribute, which starts from the value 1 and goes up from there -->
- <div class="filtr-container">
- <?php
- $servername = "NOM SERVIDOR";
- $username = "USUARI";
- $password = "PASWORD";
- $dbname = "NOM BASE DE DADES";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT * FROM `bergueda`";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- ?>
- <div class="col-xs-6 col-sm-4 col-md-3 filtr-item" data-category="<?php echo "$row[num_cat]";?>" data-sort="<?php echo "$row[titol]";?>">
- <a href="<?php echo "$row[url_img]";?>" data-lightbox="<?php echo "$row[titol]";?>"><img class="img-responsive" src="<?php echo "$row[url_img]";?>" alt="?" title="<?php echo "$row[titol]";?>" /></a>
- <span class="item-desc"><?php echo "$row[titol]";?></span>
- </div>
- <?php }
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
- </div>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement