Skip to content

Instantly share code, notes, and snippets.

@brucenorton
Last active September 12, 2016 18:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brucenorton/d21cc49cae34d953a1b650f5d153d922 to your computer and use it in GitHub Desktop.
Save brucenorton/d21cc49cae34d953a1b650f5d153d922 to your computer and use it in GitHub Desktop.
add a bit of style to our shop
<!doctype html>
<html>
<head>
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>bootstrap page</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link href="add_custom_css_here.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<head>
<body>
<?php
include '_includes/connect.php';
//define table
$tbl = "items";//change to your table i.e. John_app
$tbl2 = "photos";
//write query
$query = "SELECT $tbl.itemID, $tbl.title, $tbl.description, $tbl.price, $tbl2.src FROM $tbl, $tbl2 WHERE $tbl.itemID = $tbl2.itemID";
//prepare statement, execute, store_result
if($displayStmt = $mysqli->prepare($query)){
$displayStmt->execute();
$displayStmt->store_result();
$numrows = $displayStmt-> num_rows;
echo("<br>results: $numrows");
}
//bind results
$displayStmt->bind_result($itemIDResult, $titleResult, $descriptionResult, $priceResult, $srcResult);
?>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Bruce's Shoes</a>
</div>
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav pull-right">
<li class="active"><a href="#">Home</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<div class="container">
<h1>Bruce's Shoes</h1>
<p class="lead">Run Forrest Run.</p>
<section class="row">
<?php
//fetch results
while($displayStmt->fetch()){
?>
<div class="col-sm-4">
<h3><?php echo($titleResult)?></h3>
<?php
echo ("<img src=\"images/$srcResult\" class='img-responsive'>");
echo("<strong>$ $priceResult </strong> $descriptionResult");
?>
</div>
<?php
}
?>
</div>
</section>
</div><!-- /.container -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment