Jump to content
xisto Community
Sign in to follow this  
Wazam

Mccodes V2 - Shop With Picture

Recommended Posts

Hello,

Well I'm new to the community, and want to get around. I helped a mate with a problem he had(he's a beginner), he wanted to add a picture for his shops. I coded it for him, I don't know if it works so post any errors. :)

 

Secured

Quick Performance

Selects what's needed

Clean Coding


<?    include_once(DIRNAME(__FILE__) . '/globals.php');//  Not tested!    $_GET['shop'] = abs(@intval($_GET['shop']));   if(!$_GET['shop']) {   echo 'You begin looking through town and you see a few shops.<br />';     $Query = $db->query("SELECT `shopID` , `shopNAME` , `shopDESCRIPTION` FROM `shops` WHERE `shopLOCATION` = ".$ir['location']."");    echo '<table width = "75% cellspacing = "1" class = "table"><tr  style = "background:  gray;">           <th>Shop</th>           <th>Description</th           </tr>';   while($Info = mysql_fetch_row($Query))  {    echo '<tr>           <td><img scr = "/?????/????" width = "150" hight = "150"/></td>          <td><a href = "'.basename($_SERVER['SCRIPT_FILENAME']).'?shop=".$Info['shopID']}."">".$Info['shopNAME']."</a></td>          <td>".$Info['shopDESCRIPTION']."</td>         </tr>';  }    echo '</table>';  }  else {     $Query_2 = $db->query("SELECT `shopLOCATION` , `shopNAME` FROM `shops` WHERE `shopID` = ".$_GET['shop']."");   if (mysql_num_rows($Query_2)) {     $Info_2 = mysql_fetch_row($Query_2);  if ($Info_2['shopLOCATION'] == $ir['location']) {     echo 'Browsing items at <span style = "font-wight: bold;">'.$Info_2['shopNAME'].'</span><br /> // <B> is Deprecated          <table width = "75%" cellspacing = "1" class = "table"><tr style = "background:  gray;">            <th>Item</th>            <th>Description</th>            <th>Price</th>            <th>Sell  Price</th>            <th>Buy?</th>            <th>Buy with Credit  Card</th>           </tr>';     $Query_3 = $db->query("SELECT `itmtypename` , `itmbuyprice` , `itmsellprice` , `itmbuyprice` , `itmname` ,`itmdesc` , `itmid`                            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") or die(mysql_error());     $Info_3 = '';     while ($Reciver = mysql_fetch_row($Query_3)) {    if($info_3 != $Reciver['itmtypename']) {      $Info_3 = $Reciver['itmtypename'];   echo '\n          <tr style = "background: gray;">           <th colspan = "6">'.$Info_3.'</th>          </tr>'; }  $Buy_Price = money_formatter($Reciver['itmbuyprice']); $Sell_Price = money_formatter($Reciver['itmsellprice']); $Credit_Card_Buy_Price=money_formatter($Reciver['itmbuyprice']); echo '<tr>       <td><'.$Reciver['itmname'].'></td>       <td><'.$Reciver['itmdesc'].'></td>       <td><'.$Buy_Price.'></td>       <td><'.$Aell_Price.'></td>              <td><form action = "'.basename($_SERVER['SCRIPT_FILENAME']).'?ID='.$Reciver['itmid'].'" name = "shopbuy" method = "post">    <strong>Qty:</strong>    <input type = "text" name = "qty" value = "1" onkeyup = "tot('.$Reciver['itmid'].' || '.$Reciver['itmbuyprice'].',this.value);"  onfocus="clearText(this);"    onblur = "returnText(this);" />      <input  type = "submit" value = "Buy" /></form>   <div id = "res'.$Reciver['itmid'].'" align = "center">   </div>   </td>   <td><form action = "'.basename($_SERVER['SCRIPT_FILENAME']).'?ID='.$Reciver['itmid'].'" name = "shopbuy" method = "post">    <strong>Qty:</strong>    <input type = "text" name = "qty" value = "1" onkeyup = "tot('.$Reciver['itmid'].' || '.$Reciver['itmbuyprice'].',this.value);" onfocus = "clearText(this);" onblur="returnText(this);" />   <input  type = "submit" value = "Buy" />   </form>     <div id = "res'.$Reciver['itmid'].'" align = "center">   </div>   </td>   </tr>';  }    echo '</table>';  }  else {    echo 'You are trying to access a shop in another city!';               exit($h->endpage());  } }  else {    echo 'You are trying to access an invalid shop!';               exit($h->endpage());  } }  exit($h->endpage()); ?>

Feedback is welcome. Hope this helps, and see you around! B)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.