Sure thing, there are three pages involved including the index.php so I’ll post all three in order so if you don’t need the index.php just ignore it:
[php]
<?php **//index.php//**
session_start();
$_SESSION['username']==$dbusername;
$_SESSION['size'] = $_POST['size'];
echo "
Welcome ".$_SESSION['username']."!";
?>
<?php
//featured items
include "storescripts/connect_to_mysql.php";
$featured_list="";
$sql=mysql_query("SELECT * FROM products ORDER BY product_name ASC LIMIT 1"); //this number changes the number of featured items shown on the blackmarket page
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$featured_list.='
';
}
}else{
$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//tees
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$tees_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='tees' "); //this number changes the number of featured items shown on the blackmarket page
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$tees_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//wristbands
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$wristbands_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='wristbands' ");
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$wristbands_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//boxers
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$boxers_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='boxers' ");
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$boxers_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//hoodies
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$hoodies_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='hoodies' ");
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$hoodies_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//beanies
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$beanies_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='beanies' ");
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$beanies_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//bumper stickers
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$bumper_stickers_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='Bumper Stickers' ");
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$bumper_stickers_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//picks
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$picks_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='picks' ");
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$picks_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
<?php
//buttons
include "storescripts/connect_to_mysql.php";
//run a query to get my latest six products
$buttons_list="";
$sql=mysql_query("SELECT * FROM products WHERE subcategory='buttons' ");
$productCount=mysql_num_rows($sql);
if($productCount > 0) {
while($row=mysql_fetch_array($sql)){
$id=$row["id"];
$product_name=$row["product_name"];
$product_number=$row["product_number"];
$price=$row["price"];
$category=$row["category"];
$subcategory=$row["subcategory"];
$date_added = strftime("%b %d, %Y",strtotime($row["date_added"]));
$buttons_list.='
';
}
}else{
//$featured_list="There are no featured prodcts this week. Please check back next week for some ass-kicking deals!";
}
mysql_close();
?>
The Black Market
<?php include_once("styles/template_header.php"); ?>
Apparel
<?php echo $apparel_list; ?>
|
Weekly featured product:
</span>
<!--<table width="356" border="0">
<tr>
<th width="166" scope="row"><a href="product.php?"><img src="/cart/inventory_images/b4311.gif" width="158" height="149" border="1" /></a></th>
<td width="180" valign="top"><p>Product Title</p>
<p>Product Price</p>
<p><a href="product.php?">View Product </a></p></td>
</tr>
</table> -->
</div></td>
<td width="275" align="left" valign="top"><div align="center">
General Merchandise
|
<tr>
<td height="80" align="left" valign="top">
<class="style1">
<div align="center"><b>Tees</b><br />
<br />
<?php echo $tees_list; ?><br />
<br />
<class="style1"><b>Wristbands</b><br />
<br />
<?php echo $wristbands_list; ?><br />
<br />
<class="style1"><b>Boxers</b><br />
<br />
<?php echo $boxers_list; ?><br />
<br />
<class="style1"><b>Hoodies</b><br />
<br />
<?php echo $hoodies_list; ?><br />
<br />
<class="style1"><b>Beanies</b><br />
<br />
<?php echo $beanies_list; ?></div></td>
<td height="80" align="center" valign="top"><p class="style2"><span class="style2"><?php echo $featured_list; ?></span></p>
<div align="center">
<div align="center"></div>
</div></td>
<td height="80" align="center" valign="top"><div align="center">
<class="style1"><b>Bumper Stickers</b><br />
<br />
<?php echo $bumper_stickers_list; ?><br /><br />
<class="style1"><div align="center"><b>Picks</b><br /><br />
<?php echo $picks_list; ?></div><br /><br />
<class="style1"><div align="center"><b>Buttons</b><br /><br />
<?php echo $buttons_list; ?></div><br /><br />
<div align="center">
<div align="center"></div>
</div></td>
<?php include_once("styles/template_footer.php"); ?>
[/php]
[hr]
[php]
<?php
// Script Error Reporting
//error_reporting(E_ALL);
ini_set('display_errors', '1');
error_reporting(E_ALL ^ E_NOTICE);
?>
<?php
$submit=$_POST['submit'];
$_SESSION['size'] = $_POST['size'];
// Check to see the URL variable is set and that it exists in the database
if (isset($_GET['id'])) {
// Connect to the MySQL database
include "storescripts/connect_to_mysql.php";
$id = preg_replace('#[^0-9]#i', '', $_GET['id']);
// Use this var to check to see if this ID exists, if yes then get the product
// details, if no then exit this script and give message why
$sql = mysql_query("SELECT * FROM products WHERE id='$id' LIMIT 1");
$productCount = mysql_num_rows($sql); // count the output amount
if ($productCount > 0) {
// get all the product details
while($row = mysql_fetch_array($sql)){
$product_name = $row["product_name"];
$product_number = $row["product_number"];
$price = $row["price"];
$details = $row["details"];
$category = $row["category"];
//$size = $row["need_size"];
$date_added = strftime("%b %d, %Y", strtotime($row["date_added"]));
$shipping = $row["shipping"];
}
} else {
echo "That item does not exist.";
exit();
}
} else {
echo "Data to render this page is missing.";
exit();
}
mysql_close();
?>
<?php echo $product_name; ?>
<?php include_once("styles/template_header.php");?>
![<?php echo $product_name; ?>]()
View Full Size Image
|
<?php echo $category; ?>
<?php echo "$".$price; ?>
<?php echo "$product_name"; ?>
<?php echo $details; ?>
</p>
<form id="form1" name="form1" method="post" action="cart.php">
<p>
<input type="hidden" name="pid" id="pid" value="<?php echo $id; ?>" />
</p>
<label>Size
<select name="size">
<option>Select</option>
<option value="small">Small (petite)</option>
<option value="medium">Medium (average)</option>
<option value="large">Large (life size)</option>
<option value="xl">X-Large (full figured)</option>
<option value="xxl">XX-Large (our Hindenberg line)</option>
<option value="xxxl">XXX-Large (DAMN!!)</option>
</select>
</label>
<input type="submit" name="submit" id="size" value="Add to Shopping Cart" />
<p>
</form>
</td>
</tr>
|
Continue Shopping
<?php include_once("styles/template_footer.php");?>
[/php]
[hr]