lynm77 Posted February 21, 2012 Share Posted February 21, 2012 (edited) Hello All I hope someone may be able to help me with the following problem im having trying to add images to shops.php Even after uploading images and changes to script when i click on image the detaila i get our as follows http://www.xxxxxxx.com/itmpics/%7B$i[ This is my script for shop.php Hope fully someone can guide me to what im doing incorrect Thanks <?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>Image</th><th>Item</th><th>Description</th><th>Price</th><th>Sell Price</th><th>Buy</th><th>Credit Card</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=8>{$lt}</th></tr>"; } $buyprice=money_formatter($r['itmbuyprice']); $sellprice=money_formatter($r['itmsellprice']); $creditcardbuyprice=money_formatter($r['itmbuyprice']); ?><tr><td><img src='itmpics/{$i['itmpic']}' height='70px' width='70px'></td><td><? echo $r['itmname']; ?></td><td><? echo $r['itmdesc']; ?></td><td><? echo $buyprice; ?></td><td><? echo $sellprice; ?></td><td><form action='itembuy.php?ID=<? echo $r['itmid']; ?>' name="shopbuy" method='post'> Qty: <input type='text' name='qty' value='1' onkeyup="tot(<? echo $r['itmid']; ?>,<? echo $r['itmbuyprice']; ?>,this.value);" onfocus="clearText(this);" onblur="returnText(this);" /><input type='submit' value='Buy' /></form><div id="res<? echo $r['itmid']; ?>" align="left"></div></td><td> <form action='creditcarditembuy.php?ID=<? echo $r['itmid']; ?>' name="shopbuy" method='post'> Qty: <input type='text' name='qty' value='1' onkeyup="tot(<? echo $r['itmid']; ?>,<? echo $r['itmbuyprice']; ?>,this.value);" onfocus="clearText(this);" onblur="returnText(this);" /><input type='submit' value='Buy' /></form><div id="res<? echo $r['itmid']; ?>" align="left"></div></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 February 21, 2012 by lynm77 incorrect Quote Link to comment Share on other sites More sharing options...
Djkanna Posted February 21, 2012 Share Posted February 21, 2012 <img src='itmpics/{$i['itmpic']}' Should be <img src='itmpics/'.$i['itmpic'].'' Quote Link to comment Share on other sites More sharing options...
lynm77 Posted February 21, 2012 Author Share Posted February 21, 2012 (edited) Hello Thank you for your help but its still not selecting the image from itmpics folder When i click on image the details i get are as follows http://www.xxxxxx.com/itmpics/ Can you please advise how i get the shop item to select the correct image now Thanks Edited February 21, 2012 by lynm77 Quote Link to comment Share on other sites More sharing options...
Arson Posted February 21, 2012 Share Posted February 21, 2012 (edited) <img src='itmpics/{$i['itmpic']}' Should be <img src='itmpics/'.$i['itmpic'].'' Actually curly brackets do the same, just with less work :) So now try changing this: {$i['itmpic']} To this: {$r['itmpic']} Let me know how that goes for you. Edited February 21, 2012 by Arson Quote Link to comment Share on other sites More sharing options...
lynm77 Posted February 21, 2012 Author Share Posted February 21, 2012 Hello I have tried the following changes now all have not worked sadly with this <img src='itmpics/{$i['itmpic']}' i get the following when i click on image the details i get are as follows http://www.xxxxxxx.com/itmpics/%7B$i[ With this <img src=itmpics/'.$i['itmpic].'' i get the following when i click on image the details i get are as follows http://www.xxxxxx.com/itmpics/ With this <img src='itmpics/{$r['itmpic']}' i get the following when i click on image the details i get are as follows http://www.xxxxxxx.com/itmpics/%7B$r[ So none are selecting the images for the item from the itmpics folder Thanks to all that has helped todate but still not working any other ideas would be appreciated Quote Link to comment Share on other sites More sharing options...
chicka Posted February 21, 2012 Share Posted February 21, 2012 <img src='itmpics/{$i['itmpic']}' This should work for ya :D Quote Link to comment Share on other sites More sharing options...
lynm77 Posted February 21, 2012 Author Share Posted February 21, 2012 Hello Sorry i have tied the above already and it does not work <img src='itmpics/{$i['itmpic']}' I keep getting the following result from this http://www.xxxxxxxx.com/itmpics/%7B$i[ Quote Link to comment Share on other sites More sharing options...
Djkanna Posted February 21, 2012 Share Posted February 21, 2012 (edited) Oh wow, don't know why I didn't notice this before. :o Change {$i['itmpic']} with <?php echo $r['itmpic']; ?> Actually curly brackets do the same, just with less work -snip- Yes, but this is what happens when I don't actually bother reading the script, before answering. I just noticed ' ... ', in which I just assumed, "echo ' ... ';" (again not reading), therefore { } don't work. ;) Edited February 21, 2012 by Djkanna Quote Link to comment Share on other sites More sharing options...
chicka Posted February 21, 2012 Share Posted February 21, 2012 whats with all the php tags?? Its unnecessary with v2? Quote Link to comment Share on other sites More sharing options...
lynm77 Posted February 21, 2012 Author Share Posted February 21, 2012 Hello Chicka Thanks for your help i have all working now. Thank you Quote Link to comment Share on other sites More sharing options...
Arson Posted February 22, 2012 Share Posted February 22, 2012 Haha I didn't even notice it wasn't inside PHP tags. 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.