PHP - 如何将基于日期范围数组的Mysql数据合并到一个单元格中

I have a horizontal table which displays items based on date range. The date range is obtained from user input which is start date and end date. I place the start date and end date into an array, and I want to retrieve Item from database based on that date range. Lets say one date have more than one item, so I want all items in that particular date to be placed together in one cell only.

The table structure that I want should look like this:

-----------------------------------------------
| DATE | 2015-12-02 | 2015-12-04 | 2015-12-13 |
|------|------------|------------|------------|
| ITEM |      A     |      B     |     C, D   |
-----------------------------------------------

However, what I get for now is a separated cell of C and D. The structure looks like this:

-----------------------------------------------
| DATE | 2015-12-02 | 2015-12-04 | 2015-12-13 |
|------|------------|------------|------------|-----------
| ITEM |      A     |      B     |      C     |     D    |
----------------------------------------------------------

So, my question is, how to get the data combined in one cell based on date range array.

Here is some parts of my code: (excluding the code for getting the date range because I want to focus on the items to be displayed)

$daterange = array();
$daterange = createDateRangeArray(convertDate($from),convertDate($to));

foreach ($daterange as $value) {
$result=mysql_query("SELECT * FROM tblitem WHERE date >= '".$value." 00:00:00' AND date <= '".$value." 59:59'");

while($row=mysql_fetch_array($result)){
$item = $row['item'];
echo "<td>".$item."</td>";
  }
}