I\'m writing a quick and dirty reporting script that queries a report and emails the results. When using the MySQL console the results are in a nicely formatted table:
Building on mfonda's answer, you can really easily load the Console_Table pear package with composer now: https://packagist.org/packages/pear/console_table
$ composer require pear/console_table
"; #uncomment this line if running script in a browser
//The class isn't namespaced so just call it directly like so:
echo Console_Table::fromArray(
['column', 'headings'],
[
['1st row', 'values'],
['2nd row', 'values'],
['...', '...']
]
);
This outputs:
+---------+----------+
| column | headings |
+---------+----------+
| 1st row | values |
| 2nd row | values |
| ... | ... |
+---------+----------+