} if (!empty($values_contracts)) { $delete_old_contracts = mysqli_query($con, "DELETE FROM contracts WHERE characters_eve_idcharacters = '{$idcharacter}'"); $update_contracts = mysqli_query($con, "INSERT IGNORE INTO `trader`.`contracts` " . "(`eve_idcontracts`, " . "`issuer_id`, " . "`acceptor_id`, " . "`status`, " . "`availability`," . "`type`, " . "`creation_date`, " . "`expiration_date`, " . "`accepted_date`, " . "`completed_date`, " . "`price`, " . "`reward`, " . "`colateral`," . "`volume`, " . "`fromStation_eve_idstation`, " . "`toStation_eve_idstation`, " . "`characters_eve_idcharacters`) " . "VALUES " . implode(', ', $values_contracts)) or die(mysqli_error($con)); $newContracts = $new_c; } else { $newContracts = 0; $update_contracts = False; } //////////////////////////// //Update Market Orders ///////////////////////////// $i = -1; $pheal_orders = new Pheal($apikey, $vcode, "char"); //set scope $response_orders = $pheal->MarketOrders(array("characterID" => $idcharacter)); //add parameters $existingOrders = array(); $arrayfinal_orders = array(); $getExistingOrders = mysqli_query($con, "SELECT transkey FROM orders WHERE order_state = 'open' AND characters_eve_idcharacters = '{$idcharacter}'") or die(mysqli_error($con)); while ($orders = mysqli_fetch_array($getExistingOrders)) { array_push($existingOrders, $orders['transkey']); } foreach ($response_orders->orders as $row) { $i++; $orderID = $row->orderID; $charID = $row->charID; $stationID = $row->stationID; $volEntered = $row->volEntered; $volRemaining = $row->volRemaining; $minVolume = $row->minVolume;