dbeckerton Posted July 10, 2011 Share Posted July 10, 2011 (edited) 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 July 10, 2011 by illusions added php tags Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 10, 2011 Share Posted July 10, 2011 First off whats the field name for your itempics ? Quote Link to comment Share on other sites More sharing options...
dbeckerton Posted July 10, 2011 Author Share Posted July 10, 2011 i have since then deleted all the item SQL's to reset it and start again so it will be much easier Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 10, 2011 Share Posted July 10, 2011 ok if you add itempics in the field varchar 255 not null default 'default.jpg' if you have the admin panel to change the name of the image when you use it in the shops use <img src='images/$r['itempics']'> Quote Link to comment Share on other sites More sharing options...
dbeckerton Posted July 10, 2011 Author Share Posted July 10, 2011 ok not to be annoying here but im a bit of a noob could you give the the exact instructions and SQL and do the editing for me on the shop page i am fine without the staff panel edits but thanks if you can do it Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 10, 2011 Share Posted July 10, 2011 Look at how things work on line 34 of your script and what ive written above that should help you :) Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted July 10, 2011 Share Posted July 10, 2011 here is some help if you dont understand...However I would follow illusions advice, so you can learn to make the easiest things on your own instead of copying and pasting. http://makewebgames.io/showthread.php/23914-mccode-v2-Items-Pic-mod?highlight=item+pics Quote Link to comment Share on other sites More sharing options...
dbeckerton Posted July 10, 2011 Author Share Posted July 10, 2011 i just checked this but as i upload it i get errors Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted July 10, 2011 Share Posted July 10, 2011 (edited) 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 July 10, 2011 by lucky3809 Quote Link to comment Share on other sites More sharing options...
dbeckerton Posted July 11, 2011 Author Share Posted July 11, 2011 it seems to work till i add that line and i get this error yet its on a totally different line Parse error: syntax error, unexpected T_STRING in /home/dbeckert/public_html/shops.php on line 36 Quote Link to comment Share on other sites More sharing options...
Dominion Posted July 11, 2011 Share Posted July 11, 2011 it seems to work till i add that line and i get this error yet its on a totally different line Parse error: syntax error, unexpected T_STRING in /home/dbeckert/public_html/shops.php on line 36 You seem to get this error a lot huh? Try giving this thread a read. http://makewebgames.io/showthread.php/38148-Parse-Synax-Errors Quote Link to comment Share on other sites More sharing options...
dbeckerton Posted July 11, 2011 Author Share Posted July 11, 2011 hi everyone it is all working now thanks to everyone but is their a way to limit the image size Quote Link to comment Share on other sites More sharing options...
lucky3809 Posted July 11, 2011 Share Posted July 11, 2011 nevermind didnt see the second page. glad you got it fixed. Quote Link to comment Share on other sites More sharing options...
Uridium Posted July 12, 2011 Share Posted July 12, 2011 Im using this as an example for resizing echo '<img src="images/'.$r['itempics'].'">'; to echo '<img src="images/'.$r['itempics'].'" height=100 width=100>'; change the 100's to suit your needs for height and width Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.