Re: MySQL database export to Excel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2010-11-26 at 15:21 +0200, Sotiris Katsaniotis wrote:
> Greetings fellow PHP developers!
> 
> I am looking of a relatively simple way to export a whole database into 
> an Excel file. I have several methods to export tables to Excel files 
> but unfortunately I have failed to export a whole database!
> 
> Can someone be so kind to point me in the right direction?
> 
> Thanks a lot!
> 
DISCLAIMER
  This is untested, and just off the top of my pointy head, do some
research, and know how much strain this COULD put on your system.
/DISCLAIMER

there are MANY MySQL commands that you can use, and combine them into 1
script, and then export them into excel, using multiple pages with
something like this:

http://www.codediesel.com/php/creating-excel-documents-in-php/

example mysql queries:
SHOW DATABASES; -- gets a lits of all the databases (skip MySQL and
information_schema)

SHOW TABLES FROM {tablename};  -- gets all the tables in a specific
database


SELECT column_name FROM information_schema.columns WHERE
table_name='{tablename}' AND table_schema='{databasename}'; -- gets you
a list of all the column headers (there are other ways you can avoid
doing this, but this works)


SELECT * FROM {databasename}.{tablename}; -- gets all the rows from a
table in the database


if you were to create a script, and providing your scipt has enough
"max_execution_time", and "memory_limit" (should prolly be done from the
CLI)  you can prolly get it done... 

and yeah, this is a pointer to how it *COULD* be done, but it's not the
only way, nor is it prolly the best either.

Good Luck, and if you need more MySQL related questions answered, try
the mysql@xxxxxxxxxxxxxxx mailing list.  they are really good over
there.


Steve



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux