[code php]require_once(\"dbconn.php\"); 
header( \"Content-type: application/vnd.ms-excel\" ); 
header( \"Content-Disposition: attachment; filename=$filename.xls\" ); 
header( \"Content-Description: PHP4 Generated Data\" ); 
$sql = \"SELECT * FROM tableName\"; 
$stmt = mysql_query(\"$sql\",$conn) or die(mysql_error()); 
while ($row = mysql_fetch_row($stmt)){ 
    echo (\"$row[0]    $row[1]    $row[2]    $row[3]    ... \\r\\n\"); 
} 
mysql_free_result($stmt); 
mysql_close($conn);[/code]
댓글 없음:
댓글 쓰기