Skip to content

Instantly share code, notes, and snippets.

@mocavada mocavada/index.php
Last active Jan 3, 2018

What would you like to do?
Online Store
require( 'includes/' );
$query = "SELECT * FROM Products";
$result = mysqli_query( $db, $query ) or die(mysqli_error($db) . '<br />' . $query );
<!doctype html>
<html lang="en">
<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>
<a href="index.php">
<?php echo SITE_TITLE; ?>
<ul class="products">
<?php while( $row = mysqli_fetch_assoc( $result ) ): ?>
<h3 class="product-name">
<?php echo $row['product_name']; ?>
<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" />
<?php endwhile; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.