Jsem v práci, takže jsem to nemohl otestovat ani zkompilovat, ale doufám, že moje logika je srozumitelná.
Nejsem si jistý, jestli to bude fungovat, ale něco v tomto smyslu
$book_price_array = array(); //contents to be added.
// loop through the array an examine its price by querying your table.
foreach ($book_id_array as $key => $value) {
$price = mysql_query("SELECT price FROM table_bookPrice
WHERE book_id = {$value}");
// there is a price, set the price.
if ($price > 0 && $price != NULL) $book_price_array[$key] = $price;
// there is no price, set the default price
else $book_price_array[$key] = 500;
}