My code is as follows
while ($row = mysql_fetch_assoc($result)) {
$active_bid_ids = array_unique($row);
$item_id = $active_bid_ids['item_id'];
echo $item_id;
echo '<br />';
$sql = "SELECT item_name FROM items_list WHERE id='$item_id'";
$result = mysql_query($sql, $cn) or
die(mysql_error($cn));
$row = mysql_fetch_assoc($result);
$item_name = $row['item_name'];
echo $item_name;
}
and it seems like the query gets run only one time if I have the additional sql query in the middle whereas is I remove the line
$sql = "SELECT item_name FROM items_list WHERE id='$item_id'";
the while function runs as normal and returns many results.