The Ace Posted March 26, 2008 Posted March 26, 2008 Here is what shows up in Estate Agents: Price: £1e+15 Will: 1e+11 How do I make so that the WHOLE number is shown and not exponential figures? Quote
The Ace Posted March 26, 2008 Author Posted March 26, 2008 Re: Large Number.... There is no money_formatter anywhere....is that for V1, coz I have V2.. :-P Quote
The Ace Posted March 26, 2008 Author Posted March 26, 2008 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]   - Cost: £{$r['hPRICE']}   - Will Bar: {$r['hWILL']} "; } } $h->endpage(); ?> Quote
The Ace Posted March 27, 2008 Author Posted March 27, 2008 Re: Large Number.... Thanks a lot mate! Worked like a peach! :) lol. Cheers... :-P Quote
The Ace Posted April 4, 2008 Author Posted April 4, 2008 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(); ?> Quote
Tezza` Posted April 4, 2008 Posted April 4, 2008 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]   - Cost: £" . number_format($r['hPRICE'], "") . "   - Will Bar: " . number_format($r['hWILL'], "") . " </tr>"; } print "</table>"; } } $h->endpage(); ?> Try this. Quote
The Ace Posted April 5, 2008 Author Posted April 5, 2008 Re: Large Number.... Thanks, but now my estate looks like this: file attached! Quote
POG1 Posted April 12, 2008 Posted April 12, 2008 Re: Large Number.... Thanks, but now my estate looks like this: file attached! i like the name of the last house :P Quote
The Ace Posted April 12, 2008 Author Posted April 12, 2008 Re: Large Number.... That's actually not the last house... :-P lol Anyone know how to fix this? Quote
Analog Posted April 13, 2008 Posted April 13, 2008 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]   - Cost: £" . number_format($r['hPRICE'], "") . "   - 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? Quote
The Ace Posted April 13, 2008 Author Posted April 13, 2008 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]   - Cost: £" . number_format($r['hPRICE'], "") . "   - 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. :) Quote
Spudinski Posted April 13, 2008 Posted April 13, 2008 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(); ?> Quote
The Ace Posted April 13, 2008 Author Posted April 13, 2008 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! Quote
Magictallguy Posted May 10, 2008 Posted May 10, 2008 Re: Large Number.... Try this: <td><a href='estate.php?property={$r['hID']}'>Buy</td></tr>"; } print "</table>"; Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.