Feky Posted June 14, 2009 Share Posted June 14, 2009 function buy_house() { global $db,$ir,$c,$userid,$h; $q=$db->query("SELECT pr.*, h.*, u.* FROM propertymarket pr LEFT JOIN houses h ON prHOUSE=h.hID LEFT JOIN users u ON u.userid=pr.prOWNER ORDER BY pr.prCOST ASC",$c); if(!$db->num_rows($q)) { print "Error, either this house does not exist, or it has already been sold. > Back"; $h->endpage(); exit; } $r=$db->fetch_row($q); if($r['prCOST'] > $ir['money']) { print "Error, you do not have the funds to buy this house. > Back"; $h->endpage(); exit; } $db->query("INSERT INTO `properties` (`prID`, `prOWNER`, `prHOUSE`) VALUES ('NULL', '$userid', '{$r['hID']}');",$c); event_add($r['prOWNER'],"{$ir['username']} bought your {$r['hNAME']} from the property market for {$r['prCOST']}.",$c); $db->query("DELETE FROM propertymarket WHERE prID={$_GET['ID']}",$c); print "You bought the {$r['hNAME']} from the market for \$".number_format($r['prCOST'])."."; } $h->endpage(); ?> Can anyone fix this function when i buy house from the market it dosent take money away from me and the person that puts it on the market he dosent get paid for the house Quote Link to comment Share on other sites More sharing options...
FlashBannerMaker Posted June 14, 2009 Share Posted June 14, 2009 Re: house bug Change this part: $db->query("INSERT INTO `properties` (`prID`, `prOWNER`, `prHOUSE`) VALUES ('NULL', '$userid', '{$r['hID']}');",$c); event_add($r['prOWNER'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] bought your {$r['hNAME']} from the property market for {$r['prCOST']}.",$c); $db->query("DELETE FROM propertymarket WHERE prID={$_GET['ID']}",$c); print "You bought the {$r['hNAME']} from the market for \$".number_format($r['prCOST'])."."; } $h->endpage(); ?> To this: $db->query("INSERT INTO `properties` (`prID`, `prOWNER`, `prHOUSE`) VALUES ('NULL', '$userid', '{$r['hID']}');",$c); $db->query("UPDATE users SET money=money+{$r['prCOST']} WHERE userid={$r['prOWNER']}"); event_add($r['prOWNER'],"[url='viewuser.php?u=$userid']{$ir['username']}[/url] bought your {$r['hNAME']} from the property market for {$r['prCOST']}.",$c); $db->query("DELETE FROM propertymarket WHERE prID={$_GET['ID']}",$c); $db->query("UPDATE users SET money=money-{$r['prCOST']} WHERE userid=$userid"); print "You bought the {$r['hNAME']} from the market for \$".number_format($r['prCOST'])."."; } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Feky Posted June 14, 2009 Author Share Posted June 14, 2009 Re: house bug thank you so much lol +5 for u i give then after every hour Quote Link to comment Share on other sites More sharing options...
FlashBannerMaker Posted June 15, 2009 Share Posted June 15, 2009 Re: house bug lol thanks and no problem! Quote Link to comment Share on other sites More sharing options...
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.