Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 10th, 2003, 01:55 PM
Registered User
Join Date: Jul 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default exporting mysql databases

Is there any way to take a mysql database and saving it to disk other than saving all the data and structure as a .txt file or xml file through PHPMyAdmin? Maybe as a spreadsheet or as any other format that is easier to read than the txt file?

Old August 1st, 2003, 02:17 AM
richard.york's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts

Well, in theory that's what the CSV (comma separated values)functionality is for. Exporting to that will allow you to import into say, Excel or other applications.

My suggestion is upgrade to PHPMyAdmin 2.5.1 or later. That version has the CSV functionality built into it. As far as how good it is, I dunno. I haven't fooled with it.

: )

Smiling Souls
Old August 1st, 2003, 02:15 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 836
Thanks: 0
Thanked 0 Times in 0 Posts

You can also just hijack the source of phpMyAdmin to extract what you need. The code there works well -- if you just want to write a small script to do a specific task, that's a good place to start.

It's not terribly hard to write your own script to do it on your own though. For example, here's pseudocode for outputting all your table data into an HTML page:

For each table in the database,
   Output a heading for that table.
   Begin an HTML table.
   For each column in that table,
      Output a table header cell for that column.
   Select * from that table.
   For each row in the result set,
      For each column in the result row,
          Output a table cell for that column.


Take care,


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for Beginning databases with MYSQL sponsora MySQL 3 July 18th, 2008 06:24 AM
MySQL Connect DataBases!!! asadullah SQL Language 1 April 26th, 2007 12:54 AM
Exporting mysql to other formats fold1234 PHP Databases 5 December 5th, 2003 01:48 PM
beginning databases with mysql Dai All Other Wrox Books 0 November 6th, 2003 09:29 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.