$queryEnchants = mysql_query("SELECT * FROM WA_EnchantLinks WHERE itemId='{$auction->id}' AND itemTableId ='1'"); while (list($idk, $enchIdk, $tableIdk, $itemIdk) = mysql_fetch_row($queryEnchants)) { $updateEnch = mysql_query("INSERT INTO WA_EnchantLinks (enchId, itemTableId, itemId) VALUES ('{$enchIdk}', '4', '{$latestId}')"); } } else { $insertMarketPrice = mysql_query("INSERT INTO WA_MarketPrices (name, damage, time, marketprice, ref) VALUES ('{$auction->name}', '{$auction->damage}', '{$timeNow}', '{$newMarketPrice}', '{$marketCount}')"); } if ($useTwitter == true) { try { $twitter = new Twitter($consumerKey, $consumerSecret, $accessToken, $accessTokenSecret); $twitter->send('[WA] Item Bought: ' . $user . ' bought ' . $buyQuantity . ' x ' . $auction->fullname . ' for ' . $currencyPrefix . $itemPrice . $currencyPostfix . ' each from ' . $itemOwner . '. At ' . date("H:i:s") . '. ' . $shortLinkToAuction . ' #webauction'); } catch (Exception $e) { //may have reached twitter daily limit } } $player->buyItem($buyQuantity); $owner->sellItem($buyQuantity); $_SESSION['success'] = str_replace(array('#buyQuantity#', '#auctionFullname#', '#auctionOwner#', '#totalPrice#'), array($buyQuantity, $auction->fullname, $auction->owner, $currencyPrefix . $totalPrice . $currencyPostfix), $lang['purchaseItem']['buy_success']); if ($toDelete) { $auction->delete(); } header("Location: ../index.php"); } else { $_SESSION['error'] = $lang['purchaseItem']['buy_own_item']; header("Location: ../index.php"); } } else { $_SESSION['error'] = $lang['purchaseItem']['not_enough_money']; header("Location: ../index.php"); } }