Last active
February 7, 2016 16:26
-
-
Save estudijoanpuig/79b70b6d5e0c37420290 to your computer and use it in GitHub Desktop.
mostrar_productes en thumbnails.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section id="disseny_web" class="content-section text-center"> | |
<div class="bs-example" data-example-id="thumbnails-with-custom-content"> | |
<div class= "container"> | |
<font color="red"> <h2>DISSENY WEB</h2></font> | |
<p>ANAR-HI per a veure cadasquna d'aquestas WEBS .</p> | |
<div class="row"> | |
<?php | |
$servername = "SERVIDOR"; | |
$username = "USUARI"; | |
$password = "PARAULA DE PAS"; | |
$dbname = "BASE DE DADES"; | |
// Create connection | |
$conn = new mysqli($servername, $username, $password, $dbname); | |
// Check connection | |
if ($conn->connect_error) { | |
die("Connection failed: " . $conn->connect_error); | |
} | |
// CONSULTA PER A MOSTRAR DE LA TAULA PRODUCTES ELS QUE TENEN LA CATEGORIA "disseny_web" | |
$sql = "SELECT * FROM `producte` WHERE `categoria`='disseny_web'"; | |
$result = $conn->query($sql); | |
if ($result->num_rows > 0) { | |
// output data of each row | |
while($row = $result->fetch_assoc()) { | |
echo "<div class= col-md-4 >"; | |
echo "<div class=thumbnail>"; | |
echo "<img src='$row[url_imatge]'alt=Item 1 width=100% class=img-responsive>"; | |
echo "<div class=caption>"; | |
echo "<h3>$row[nom_producte]</h3>"; | |
echo "<p>$row[descripcio_producte]</p>"; | |
echo "<p><a href=$row[url_link] class= btn btn-primary btn-lgrole=button >anar-hi</a></p>"; | |
echo "</div>"; | |
echo "</div>"; | |
echo "</div>"; | |
} | |
} else { | |
echo "0 results"; | |
} | |
$conn->close(); | |
?> | |
</div> | |
</div> | |
</div> | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment