Jump to content
MakeWebGames

Recommended Posts

Posted

so i added the item pic mod and everything works fine (adding items , editing) but how do i make it display the image before the name of the item or a column before the item column saying "image"

heres my shop.php

<?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.
";
$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>[url='shops.php?shop={$r[']{$r['shopNAME']}[/url]</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]

<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><th>Buy with 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=6>{$lt}</th></tr>";

}
$buyprice=money_formatter($r['itmbuyprice']);
$sellprice=money_formatter($r['itmsellprice']);
$creditcardbuyprice=money_formatter($r['itmbuyprice']);
?><tr><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="center"></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="center"></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();
?>
Posted

Re: [NEED Help][MCCODES V2] Item Pic Mod

if you want learn mcc use this bit......

on line 24 add <th>Image</th> before the <th>Item</th>

Then on line 32 change colspan to 6 not 5

The reason for 6 is because your adding a one new row so if you add another it would become 7 and so on

---------------------------------------------------------------------------------------------------

 

if you cant be bothered then copy and paste this one.

 

<?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.
";
$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>[url='shops.php?shop={$r[']{$r['shopNAME']}[/url]</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]

<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></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>[img=itmpics/{$r[]</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();
?>

 

this will set the image next to the ITEM

  • 5 months later...
Posted

Re: [NEED Help][MCCODES V2] Item Pic Mod

here, use this shops code with pic before everything else, maybe this is what you're looking for.

 

<?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.
";
$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>[url='shops.php?shop={$r[']{$r['shopNAME']}[/url]</td><td><font color='#BDBDBD'>{$r['shopDESCRIPTION']}</font></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 the [b]{$shopdata['shopNAME']}[/b]...

<table cellspacing=1 class='table'><tr style='background: gray;'><th>Image</th><th>Item</th><th>Info</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=6>{$lt}</th></tr>";
}
print "\n<tr><td>[img=itmpics/{$r[]</td><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' size='3' 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();
?>
  • 1 year later...
Posted

Your getting that error because when this forum transferred to the new layout, it left behind html coding that was not part of the original mod posted, its this forum error that you got.

for an example:

print "<tr><td><a href="http://shops.php?shop={$r[" target=_blank">{$r['shopNAME]}</a></td><td>{$r['shopDESCRIPTION']}</td></tr>";

the original one was:

print "<tr><td><a href="shops.php?shop={$_GET['shop']}">{$r['shopNAME']}</a></td><td>{$r['shopDESCRIPTION']}</td></tr>";

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...