<?php
      header("Pragma: public");
      header("Expires: 0");
      $DateAndTime = date('m-d-Y h:i:s a', time());
      $filename = "Listado_Completo_$DateAndTime.xls";
      header("Content-type: application/x-msdownload");
      header("Content-Disposition: attachment; filename=$filename");
      header("Pragma: no-cache");
      header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

      ?>
      <table>
      <tbody>
      <tr>
      <th>
      <b>Listado actualizado a la fecha <? echo $DateAndTime ?></b>
      </th>
      </tr>


      <tr>
      <td>ARTICULO</td>
      <td>CODIGO</td>
      <td>STOCK</td>
      <td>PRECIO</td>
      </tr>

      <?
      include 'concha.php';
      mysql_connect ("$host", "$usuario", "$contra");
      mysql_select_db ("$basedatos");

      $sql = "SELECT * FROM `articulos` WHERE `brand` = 1 ORDER BY titulo";

      $consulta = mysql_query ($sql);
      while ($row = mysql_fetch_array($consulta))
      {

      $titulo = $row["titulo"];
      $stock = $row["stock"];
      $barcode = $row["barcode"];
  $precio = $row["precio"];


  ?>
      <tr>
      <td><? echo   $titulo ?></td>
      <td><? echo   $barcode ?></td>
      <td><? echo $stock?></td>
      <td><? echo $precio ?></td>
      </tr>

    <?      }
        mysql_free_result($consulta);

        ?>
      </tbody>
      </table>
