Last active
January 3, 2018 20:19
-
-
Save mocavada/d0169816da0346afc3fe3f93c1c70575 to your computer and use it in GitHub Desktop.
Online Store
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
<?php | |
require( 'includes/config.inc.php' ); | |
$query = "SELECT * FROM Products"; | |
$result = mysqli_query( $db, $query ) or die(mysqli_error($db) . '<br />' . $query ); | |
?> | |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Products - <?php echo SITE_TITLE ?></title> | |
<!-- link to the main stylesheet --> | |
<link rel="stylesheet" href="css/reset.css" /> | |
<link rel="stylesheet" href="css/style.css" /> | |
<!--[if lt IE 9]> | |
<script src="js/html5shiv.min.js"></script> | |
<![endif]--> | |
</head> | |
<body> | |
<header> | |
<h1> | |
<a href="index.php"> | |
<?php echo SITE_TITLE; ?> | |
</a> | |
</h1> | |
</header> | |
<main> | |
<h2>Products</h2> | |
<ul class="products"> | |
<?php while( $row = mysqli_fetch_assoc( $result ) ): ?> | |
<li> | |
<h3 class="product-name"> | |
<?php echo $row['product_name']; ?> | |
</h3> | |
<p class="description short"><?php echo substr(($row['description']), 0, 100); ?> ....</p> | |
<p class="price"><?php echo $row['price']; ?></p> | |
<img style="max-width: 100px;" class="image" src="<?php echo $row['image_url']; ?>" alt="Product Name" /> | |
</li> | |
<?php endwhile; ?> | |
</ul> | |
</main> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment