Announcement

Collapse
No announcement yet.

Help with adding images to shop.php

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [ V2 ] Help with adding images to shop.php

    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 Code:
    <?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();
    ?>
    Last edited by lynm77; 02-21-2012, 12:25 AM. Reason: incorrect

  • #2
    PHP Code:
    <img src='itmpics/{$i['itmpic']}' 
    Should be
    PHP Code:
    <img src='itmpics/'.$i['itmpic'].'' 
    "We believe that bad sex and good drugs are the cornerstones of a great democracy."
    - P.A.G.A.N
    Will you be (Mg,Fe)7Si8O22(OH)2 ?



    Comment


    • #3
      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

      Can you please advise how i get the shop item to select the correct image now

      Thanks
      Last edited by lynm77; 02-21-2012, 07:03 PM.

      Comment


      • #4
        Originally posted by Djkanna View Post
        PHP Code:
        <img src='itmpics/{$i['itmpic']}' 
        Should be
        PHP Code:
        <img src='itmpics/'.$i['itmpic'].'' 
        Actually curly brackets do the same, just with less work

        So now try changing this:
        PHP Code:
        {$i['itmpic']} 
        To this:
        PHP Code:
        {$r['itmpic']} 
        Let me know how that goes for you.
        Last edited by Arson; 02-21-2012, 07:39 PM.
        Add your game to my list of text based games.

        Comment


        • #5
          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

          Comment


          • #6
            Code:
            <img src='itmpics/{$i['itmpic']}'
            This should work for ya

            Comment


            • #7
              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[

              Comment


              • #8
                Oh wow, don't know why I didn't notice this before.

                Change {$i['itmpic']}
                with <?php echo $r['itmpic']; ?>

                Originally posted by Arson View Post
                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.
                Last edited by Djkanna; 02-21-2012, 10:12 PM.
                "We believe that bad sex and good drugs are the cornerstones of a great democracy."
                - P.A.G.A.N
                Will you be (Mg,Fe)7Si8O22(OH)2 ?



                Comment


                • #9
                  whats with all the php tags?? Its unnecessary with v2?

                  Comment


                  • #10
                    Hello Chicka

                    Thanks for your help i have all working now.

                    Thank you

                    Comment


                    • #11
                      Haha I didn't even notice it wasn't inside PHP tags.
                      Add your game to my list of text based games.

                      Comment

                      Working...
                      X