Jump to content
MakeWebGames

Large Number....


The Ace

Recommended Posts

Re: Large Number....

Do you mean the estate.php?

Here it is:

<?php
include "globals.php";
$mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$mp=$db->fetch_row($mpq);
$_GET['property']=abs((float) $_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['hrNAME']}.";
}
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 wooden hut.";
}
}
else
{
print "Your current property: [b]{$mp['hNAME']}[/b]

The houses you can buy are listed below. Click a house to buy it.
";
if($ir['maxwill'] > 100)
{
print "[url='estate.php?sellhouse']Sell Your House[/url]
";
}
$hq=$db->query("SELECT * FROM houses WHERE hWILL>{$ir['maxwill']} ORDER BY hWILL ASC");
while($r=$db->fetch_row($hq))
{

print "[url='estate.php?property={$r[']{$r['hNAME']}[/url] &nbsp - Cost: £{$r['hPRICE']} &nbsp - Will Bar: {$r['hWILL']}
";
}
}
$h->endpage();
?>
Link to comment
Share on other sites

  • 2 weeks later...

Re: Large Number....

I have got the updated version of the estate agents, but I have the same problem, but with just the will. I can't seem to get it to work, to show the whole number. Here is my new estate.php code:

<?php
include "globals.php";
$mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$mp=$db->fetch_row($mpq);
$_GET['property']=abs((float) $_GET['property']);
if($_GET['property'])
{
$mpq=$db->query("SELECT * FROM houses WHERE hID={$_GET['property']}");
$np=$db->fetch_row($mpq);
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 wooden hut.";
}
}
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>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><a href='estate.php?property={$r['hID']}'>Buy</tr>";
}
print "</table>";
}
}
$h->endpage();
?>
Link to comment
Share on other sites

Re: Large Number....

 

<?php
include "globals.php";
$mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$mp=$db->fetch_row($mpq);
$_GET['property']=abs((float) $_GET['property']);
if($_GET['property'])
{
$mpq=$db->query("SELECT * FROM houses WHERE hID={$_GET['property']}");
$np=$db->fetch_row($mpq);
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 wooden hut.";
}
}
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>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>[url='estate.php?property={$r[']{$r['hNAME']}[/url] &nbsp - Cost: £" . number_format($r['hPRICE'], "") . " &nbsp - Will Bar: " . number_format($r['hWILL'], "") . "
</tr>";
}
print "</table>";
}
}
$h->endpage();
?>

 

Try this.

Link to comment
Share on other sites

Re: Large Number....

It appears to basically be a problem of not enough room within the table to display the entire number, thus its making 3.3e+06...etc

I say this because in the column to the right it is correctly displayed...

Find:

<td>[url='estate.php?property={$r[']{$r['hNAME']}[/url] &nbsp - Cost: £" . number_format($r['hPRICE'], "") . " &nbsp - Will Bar: " . number_format($r['hWILL'], "") . "
</tr>";

 

Change to:

<td>[url='estate.php?property={$r[']Buy[/url]</td></tr>";

 

What I did is removed all the house info from the link. Why display it twice in the same place?

Link to comment
Share on other sites

Re: Large Number....

I don't think that was for the updated version...because I can't find:

<td>[url='estate.php?property={$r[']{$r['hNAME']}[/url] &nbsp - Cost: £" . number_format($r['hPRICE'], "") . " &nbsp - Will Bar: " . number_format($r['hWILL'], "") . "
</tr>";

in my updated one....

If you don't mind, could you please try and do it with:

<?php
include "globals.php";
$mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$mp=$db->fetch_row($mpq);
$_GET['property']=abs((float) $_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($mpq);
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 wooden hut.";
}
}
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>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><a href='estate.php?property={$r['hID']}'>Buy</tr>";
}
print "</table>";
}
}
$h->endpage();
?>

 

because my will is still going into the +e...

Thanks. :)

Link to comment
Share on other sites

Re: Large Number....

HTML elements will automatically expand to accommodate text, thus the CSS properties min-width and max-width are there.

Try adding the number_format function to the will value, you could use the user-defined money_formatter but I see no point in using that if you can use an internal function that does almost exactly the same.

Use this:

<?php
include "globals.php";
$mpq=$db->query("SELECT * FROM houses WHERE hWILL={$ir['maxwill']}");
$mp=$db->fetch_row($mpq);
$_GET['property']=abs((float) $_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($mpq);
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 wooden hut.";
}
}
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>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>" . number_format($r['hWILL'] . "</td>
<td><a href='estate.php?property={$r['hID']}'>Buy</tr>";
}
print "</table>";
}
}
$h->endpage();
?>
Link to comment
Share on other sites

Re: Large Number....

Thanks, but there is a slight problem with:

<td><a href='estate.php?property={$r['hID']}'>Buy</tr>";
}
print "</table>";

 

I did get rid of the "; after </tr>, but then there was a parse error on the other line...something wrong with the / in </table>....grr!

Link to comment
Share on other sites

  • 4 weeks later...

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