[英]What is the best way to generate & print out data from mysql database
Let's say I want print out 1 mil user record from database to paper.假设我想将 1 百万用户记录从数据库打印到纸上。
The output format will be something like this. output 格式将是这样的。
No Name Address Phone Class Teacher
----------------------------------------------------
1 John 123-etc 3214124 5 Miku
2 L.Gaga 123-etc 3214124 9 Koru
..
..
..
..
10000000 Puke 123123 3214124 2 Goku
What is the best method to print out this data without adding any limit to mysql query?在不对 mysql 查询添加任何限制的情况下打印出此数据的最佳方法是什么?
What I normally do in such a case, is using a tool like Navicat to write a query that gives me exactly the columns I need, ordered in the way I need them, and then use the export function of the tool to save the result in an Excel file.在这种情况下,我通常会使用 Navicat 之类的工具编写一个查询,该查询准确地提供了我需要的列,按照我需要的方式排序,然后使用该工具的 export function 将结果保存在Excel 文件。
That way I get all the Excel (or OpenOffice, for that matter) options for printing, including scaling to get as much records on one page as possible.这样我就可以获得所有 Excel(或 OpenOffice,就此而言)选项进行打印,包括缩放以在一页上获得尽可能多的记录。
You could query as normal and use PHP to write the results to a CSV file for further formatting, printing, etc. http://php.net/manual/en/function.fputcsv.php You could query as normal and use PHP to write the results to a CSV file for further formatting, printing, etc. http://php.net/manual/en/function.fputcsv.php
I don't think 1 million rows will be too much, but it will depend on your hardware (memory), environment (php timeouts), and the actual data.我认为 100 万行不会太多,但这取决于您的硬件(内存)、环境(php 超时)和实际数据。 The paper itself might be a problem, though.
不过,论文本身可能是个问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.