Skip to content

Instantly share code, notes, and snippets.

@estudijoanpuig
Last active September 23, 2021 16:32
Show Gist options
  • Save estudijoanpuig/dc269ecc8a79f46d7e6409ce25d50ec5 to your computer and use it in GitHub Desktop.
Save estudijoanpuig/dc269ecc8a79f46d7e6409ce25d50ec5 to your computer and use it in GitHub Desktop.
llibreria datatables
<section id="llibreria" class="py-16" data-uk-filter="target: .js-filter; animation: fade">
<div class="container">
<div class="text-center">
<h2 class="mb-12 section-heading wow fadeInDown" data-wow-delay="0.3s">llibreria</h2>
<div>
<div id='recipients' class="p-2 mt-5 lg:mt-0 rounded shadow bg-white">
<table id="example" class="stripe hover" style="width:100%; padding-top: 1em; padding-bottom: 1em;">
<thead>
<tr>
<th data-priority="1">id</th>
<th data-priority="1">nom</th>
<th data-priority="2">descripcio</th>
<th data-priority="3">categoria</th>
<th data-priority="4">projecte</th>
<th data-priority="5">download</th>
<th data-priority="6">youtube</th>
<th data-priority="7">github</th>
<th data-priority="8">img</th>
</tr>
</thead>
<tbody>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "voyager";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM `llibreria` order by id asc";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
?>
<tr>
<td><?php echo "$row[id]";?></td>
<td><a href="<?php echo "$row[projecte]";?>"target="_blank" ><?php echo "$row[nom]";?></a></td>
<td><a data-fancybox data-type="iframe" data-src="embed/wordpress/wp_uikit.txt" href="javascript:;">wordpres amb polestar child i paginas personalitzadas</a>/</td>
<td><?php echo "$row[categoria]";?></td>
<td><a href="<?php echo "$row[projecte]";?>"target="_blank"><?php echo "$row[projecte]";?></a></td>
<td><a href=""target="_blank">https://ca.wordpress.org/download/</a></td>
<td><a data-fancybox href="https://www.youtube.com/watch?v=ZCfSrbW4kZA">https://www.youtube.com/watch?v=ZCfSrbW4kZA</a></td>
<td><a href="https://github.com/WordPress/WordPress"target="_blank">https://github.com/WordPress/WordPress</a></td>
<td><a href="<?php echo "$row[img]";?>"><img data-fancybox="gallery" src="public/img/koaliticphoto.png" alt="HTML tutorial" ></a></td>
</tr>
<?php }
} else {
echo "0 results";
}
$conn->close();
?>
</tbody>
</table>
</div>
</div>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment