There are two tables, products and productcolor. Each product can have multiple color. I want to fetch color of products in dropdown. But not able to do that with following code.
 <?php
    $results = $mysqli->query("SELECT product_code, product_name, product_desc, product_img_name, price FROM products ORDER BY id ASC");
    if($results){ 
    $products_item = '<ul class="products">';
    //fetch results set as object and output HTML
    while($obj = $results->fetch_object())
    {  
        $id = $obj->id;
        $results1 = $mysqli->query("SELECT colornmae FROM productcolor where id=$id");
      if($results1){ 
        while($obj1 = $results1->fetch_object())
        {  
        $color[] = $obj1->colorname;
        }
      }
    $products_item .= <<<EOT
        <li class="product">
        <form method="post" action="cart_update.php">
        <div class="product-content"><h3>{$obj->product_name}</h3>
        <div class="product-thumb"><img src="images/{$obj->product_img_name}"></div>
        <div class="product-desc">{$obj->product_desc}</div>
        <div class="product-info">
        Price {$currency}{$obj->price} 
        <fieldset>
        <label>
            <span>Color</span>
            <select name="product_color">
            foreach ($color as $value) {
            <option value="{$value}">{$value}</option>
            }
            </select>
        </label>
        <label>
            <span>Quantity</span>
            <input type="text" size="2" maxlength="2" name="product_qty" value="1" />
        </label>
        </fieldset>
        <input type="hidden" name="product_code" value="{$obj->product_code}" />
        <input type="hidden" name="type" value="add" />
        <input type="hidden" name="return_url" value="{$current_url}" />
        <div align="center"><button type="submit" class="add_to_cart">Add</button></div>
        </div></div>
        </form>
        </li>
    EOT;
    }
    $products_item .= '</ul>';
    echo $products_item;
    }
    ?>    
I have searched for solution. Then I came to know that php code can't be written in EOT. php variables can be shown in EOT. But here i want to do looping to values of color from database. I have tried various combination but nothing worked. Above is my one of the attempt of doing that which is not working. 
How do I get colorname of product in dropdown which is fetching from database as object in between EOT?
Can anyone please help me in this?
 
     
    