Jump to content
MakeWebGames

Item Picture (Shop) Need Super Help


dbeckerton

Recommended Posts

Hello Everyone this is my second post as i think i did not add enough information could somebody please edit my shop.php which is currently using v2 i believe and give me the instructions with the SQL e.t.c or use ECHO

 

<?php
include "globals.php";
$_GET['shop'] = abs((int) $_GET['shop']);
if(!$_GET['shop'])
{
print "You begin looking through town and you see a few shops.<br />";
$q=$db->query("SELECT * FROM shops WHERE shopLOCATION={$ir['location']}");
print "<table width=85% cellspacing=1 class='table'><tr style='background: gray;'><th>Shop</th><th>Description</th></tr>";
while($r=$db->fetch_row($q))
{
print "<tr><td><a href='shops.php?shop={$r['shopID']}'>{$r['shopNAME']}</a></td><td>{$r['shopDESCRIPTION']}</td></tr>";
}
print "</table>";
}
else
{
$sd=$db->query("SELECT * FROM shops WHERE shopID={$_GET['shop']}");
if($db->num_rows($sd))
{
$shopdata=$db->fetch_row($sd);
if($shopdata['shopLOCATION'] == $ir['location'])
{
print "Browsing items at <b>{$shopdata['shopNAME']}...</b><br />
<table cellspacing=1 class='table'><tr style='background: gray;'><th>Item</th><th>Description</th><th>Price</th><th>Sell Price</th><th>Buy</th></tr>";
$qtwo=$db->query("SELECT si.*,i.*,it.* FROM shopitems si LEFT JOIN items i ON si.sitemITEMID=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE si.sitemSHOP={$_GET['shop']} ORDER BY i.itmtype ASC, i.itmbuyprice ASC, i.itmname ASC");
$lt="";
while($r=$db->fetch_row($qtwo))
{
if($lt!=$r['itmtypename'])
{
$lt=$r['itmtypename'];
print "\n<tr style='background: gray;'><th colspan=5>{$lt}</th></tr>";
}
print "\n<tr><td>{$r['itmname']}</td><td>{$r['itmdesc']}</td><td>\${$r['itmbuyprice']}</td><td>\${$r['itmsellprice']}</td><td><form action='itembuy.php?ID={$r['itmid']}' method='post'>Qty: <input type='text' name='qty' value='1' /><input type='submit' value='Buy' /></form></td></tr>";
}
print "</table>";
}
else
{
print "You are trying to access a shop in another city!";
}
}
else
{
print "You are trying to access an invalid shop!";
}
}
$h->endpage();
?>
Edited by illusions
added php tags
Link to comment
Share on other sites

Add the sql:

ALTER TABLE `items` ADD `itempics` VARCHAR( 255 ) NOT NULL ;

in your page where you want the pic to show add:

echo '<img src="images/'.$r['itempics'].'">';

note: images/ is the folder that you would place your itempics in, if you have them on public_html and not in an images folder then erase the images/

After you done this, go into your phpmyadmin database and click on your ITEMS table, then you should be on the BROWSE tab, pick the item you want to add a pic to and select the PENCIL (which is edit) then under ITEMPICS in the VALUE area place your pic location such as: images/default.png then click GO and your done.

Edited by lucky3809
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...