rendered paste body<?php include('header.php'); ?>
<?php
$id = mysql_real_escape_string($_GET['id']);
$id = stripslashes($_GET['id']);
$id = str_replace("'","",$id);
$id = str_replace("/","",$id);
$sql[shop] = "SELECT * FROM `shops` WHERE `id` =$id";
$res[shop] = mysql_query($sql[shop]);
$rowshop = mysql_fetch_assoc($res[shop]);
if(!isset($id)){
header("Location: market.php");
die();
}else {
//notice the white space?
if(mysql_num_rows($res[shop]) == 0){
error("This shop does not exist!");
}else {
echo "<p align='center'><a href='shops.php?id=$id'><img src='$rowshop[shopkeeper]' border='0'></a><br><b>Welcome to the $rowshop[name] shop!</b><br><em>$rowshop[description]</em>\n";
echo "<table border=0 cellspacing=3 cellpadding=2>\n";
$sql[stock] = "SELECT * FROM `shopstock` WHERE `place` ='$rowshop[type]'";
$res[stock] = mysql_query($sql[stock]) or die(mysql_error());
if(mysql_num_rows($res[stock]) == 0){
echo "<tr><td>There are <b>no items</b> avaiable at the moment, try again in 10 minutes!";
}else {
echo "<tr><td>\n";
while($rowstock = mysql_fetch_assoc($res[stock])){
//items will be echo'd here
}
}
echo "</table>";
echo "</p>";
}
}
?>
<?php include('footer.php'); ?>