Export data to CSV

/ Published in: PHP
Save to your folder(s)

The best part about this script is that any table you put in the query on line 14 will be the headers and data in the CSV. No need to hand type out all the table headers unless you want to comment that section out and put in your own. So if you have a table full of users that includes: name, email, website, phone you could create a query like:

SELECT name, email, website, phone FROM users

This would pull only those fields to the CSV if you had other data like passwords, nicknames or instant messenger addresses in the same table.

URL: http://www.wlscripting.com/tutorial/37

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.