$-Chinion-$ Posted April 5, 2011 Posted April 5, 2011 I know I shouldn't post it here, I just couldn't define where it should go... I got a suggestion from one of my players asking for when it displays there house, it displays the price of it to. I have this line of code for the house name.. print "Your current property: <b>{$mp['hNAME']}</b><br /> to display the price I put this, but it didn't work print "Your current property: <b>{$mp['hNAME']}</b><b>{$np['hPRICE']}</b><br /> Can anyone suggest what I would do? Quote
Nickson Posted April 5, 2011 Posted April 5, 2011 have you made a typo? You have used $mp in the first, and $np in the second part... make sure that those variables are correct. I assume you wanted to use {$mp['hPRICE']} instead of {$np['hPRICE']} ? Quote
$-Chinion-$ Posted April 5, 2011 Author Posted April 5, 2011 No I'm sure that I haven't made a typo, at first I thought I did then I looked through the code. here's my code. <?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['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 shed."; } } else { print "Your current property: <b>{$mp['hNAME']}</b><b>{$np['hPRICE']}</b><br /> The houses you can buy are listed below. Click a house to buy it.<br />"; if($ir['maxwill'] > 100 && $ir['marriedwill'] == 0) { echo'<a href="?sellhouse">Sell Your House</a><br /><br />'; } $hq=$db->query("SELECT * FROM houses WHERE hWILL>{$ir['maxwill']} ORDER BY hWILL ASC"); while($r=$db->fetch_row($hq)) { print "<a href='estate.php?property={$r['hID']}'>{$r['hNAME']}</a>   - Cost: \${$r['hPRICE']}   - Will Bar: {$r['hWILL']}<br />"; } } $h->endpage(); ?> 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.