<?php
header('Content-Encoding: UTF-8');
header('Content-type: text/csv; charset=UTF-8');
header('Content-Disposition: attachment; filename=wines.xls');
echo "\xEF\xBB\xBF"; // UTF-8 BOM
?>
<table border='1' width="70%">
<tr>
          <th scope="col">ID</th>
          <th scope="col">Unique ID</th>
          <th scope="col">Name</th>
          <th scope="col">Price</th>
          <th scope="col">Date Added</th>
</tr>
          <? foreach($data1 as $products=>$prd){ ?>
          <tr>
            <td><?=$prd['id']?></td>
            <td><?=$prd['p_id']?></td>
            <td><?=$prd['name']?></td>
            <td><?=$prd['price']?></td>
            <td><?=date("d/m/Y",mysql_to_unix($prd['date_added']))?></td>
          </tr>
          <? } ?>
</table>