Jump to content
MakeWebGames

I need a little help


dbeckerton

Recommended Posts

can anybody help me i have this really good table and images for my estate.php and i want to be able to make it so my shops look similar so they show the item images

 

<?php
include "globals.php";
$mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$mp=$db->fetch_row($mpq);
$_GET['property']=abs((int) $_GET['property']);
if($_GET['property'])
{
$npq=$db->query("SELECT * FROM houses WHERE hID={$_GET['property']}");
$np=$db->fetch_row($npq);
if($np['hWILL'] < $mp['hWILL'])
{
print "You cannot go backwards in houses!";
}
else if ($np['hPRICE'] > $ir['money'])
{
print "You do not have enough money to buy the {$np['hNAME']}.";
}
else
{
$db->query("UPDATE users SET money=money-{$np['hPRICE']},will=0,maxwill={$np['hWILL']} WHERE userid=$userid");
print "Congrats, you bought the {$np['hNAME']} for \${$np['hPRICE']}!";
}
}
else if (isset($_GET['sellhouse']))
{
$npq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$np=$db->fetch_row($npq);
if($ir['maxwill'] == 100)
{
print "You already live in the lowest property!";
}
else
{
$db->query("UPDATE users SET money=money+{$np['hPRICE']},will=0,maxwill=100 WHERE userid=$userid");
print "You sold your {$np['hNAME']} and went back to your shed.";
}
}
else
{
print "<center>Your current property: <font color=blue>[b]{$mp['hNAME']}[/b]</font>
The houses you can buy are listed below. Click a house to buy it.
";
print "[url='estate.php?sellhouse']Sell Your House[/url]
";
if($ir['willmax'] > 100)
{
}
$hq=$db->query("SELECT * FROM houses WHERE hWILL>{$ir['maxwill']} ORDER BY hWILL ASC");
while($r=$db->fetch_row($hq))
{
print "

<table cellspacing=2 class='table'><tr style='background:gray;'><th>House</th><th>House Price</th><th>House Will</th><th>Image</th><th>Buy?</th></tr>";
$hq=mysql_query("SELECT * FROM houses WHERE hWILL>{$ir['maxwill']} ORDER BY hWILL ASC",$c);
while($r=$db->fetch_row($hq))
{
print "<tr><td>{$r['hNAME']}</a></td><td>\$$t".money_formatter($r['hPRICE'],'')."</td>
<td>{$r['hWILL']}</td>
<td>[img=hsepics/{$r[]</td>
<td><a href='estate.php?property={$r['hID']}'>Buy</tr>";
}
print "</table>";
}
}
$h->endpage();
if($ir['married']) {
die("You cannot manage your estate agent while your being married!"); }

?>
Link to comment
Share on other sites

this is my shops

<?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>{$r['shopNAME']}</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 {$shopdata['shopNAME']}...

<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();

?>

Link to comment
Share on other sites

lol no he means like this

<?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();
?>
Link to comment
Share on other sites

Wouldn't it be simple, to ad another <TD> & <IMG SCR=""> be easy enough? Also, most people need to stop selecting every thing from a full table. I don't know the size of any, but some might be huge(Users & Forum probs). I don't know much on MCC, but $r has something to do with a query adding in via PHPMYADMIN? If so. What you need selecting will be $r will be down the page where ever the query is added. Just a thought. :)

 

<?
   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.
';

   $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>
// [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">

  [b]Qty:[/b] 
  <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">

  [b]Qty:[/b] 
  <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());
?>
Link to comment
Share on other sites

$ir holds all user data the query is in globals.php for v2 and v1/lite has it at the top of most pages download lite if you wish to learn the engine (since its easy for them to just call $ir) as for taking everything out of the tables yes they are over used however they are also the reasion that so many mods pop up it would take a recode of the engine to make it fully "optimized" and thats not worth it for some people who are only going to put 10% into keeping there game running

 

@topic there are free mods that allow this and the poster above is right its very easy feel free to look around i am sure you will find something

Link to comment
Share on other sites

  • 8 months later...

how hard really is it to add a item,shop,estate pic? do you not use a display_pic on your profile pages? If so the code should already be there, you really don't need help if you cant figure out what tag to place it in, you should read up on tables or divs which ever you use.... just saying...

Link to comment
Share on other sites

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