【发布时间】:2011-12-01 18:38:13
【问题描述】:
我有一个简单的表,用于存储与下载相关的唯一 ID。我想要做的是生成最近创建的 ID 的 CSV。每次生成密钥时(一次从 1 到 100 个密钥),都会与这些密钥一起存储一个 UNIX 时间戳。
我的 CSV 文件生成得很好,但我无法让 MAX 功能正常工作。我的报告生成器如下:
// output headers so that the file is downloaded rather than displayed
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename=codes.csv');
// create a file pointer connected to the output stream
$output = fopen('php://output', 'w');
// output the column headings
fputcsv($output, array('Unique Codes'));
// fetch the data
/** database username and pass removed **/
$rows = mysql_query('SELECT uniqueid FROM downloadkeys');
// loop over the rows, outputting them
while ($row = mysql_fetch_assoc($rows)) fputcsv($output, $row);
【问题讨论】: