$item_prices_db = $db->query("SELECT `market_hash_name`, `price` FROM `items` WHERE `market_hash_name` IN(?list)", [$marketnames], 'assoc');
$ipdb = [];
foreach ($item_prices_db as $ipd) {
$ipdb[$ipd['market_hash_name']] = [$ipd['price']];
}
foreach ($item_array as &$v) {
$v['price'] = $ipdb[$v['market_hash_name']][0];
}