Jump to content

Eric_Raven

Novato
  • Posts

    4
  • Joined

  • Last visited

Información Personal

  • Pais
    Chile
  • Genero
    Hombre

Eric_Raven's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. voy a donar el mio que esta más optimizado ya que crea las columnas de forma dinámica solo hace falta el nombre de la tabla <? header("Content-type: application/vnd.ms-excel"); header("Content-Disposition: attachment; filename=registros.xls"); //Tabla dinámica Eric Birkner 2008 include('../config.php'); $sql = "show columns from registros"; $res = mysql_query($sql); $campos = mysql_num_rows($res); echo $campos; $head = '<tr>'; while($lst = mysql_fetch_array($res)){ $head.= "<th>".$lst[0]."</th>"; } $head.= '</tr>'; $sql2 = "select * from registros"; $res2 = mysql_query($sql2); while($value = mysql_fetch_array($res2)){ $lst_usuario .= '<tr>'; for($i=0;$i<$campos;$i++){ $lst_usuario .= '<td>'.$value[$i]. '</td>'; } $lst_usuario .= '</tr>'; } print "<table border=1>".$head.$lst_usuario."</table>"; ?>
  2. hacen el intento pero a ratos se hace muy fome el corto
×
×
  • Create New...