Online Book Reader

Home Category

HTML, XHTML and CSS All-In-One for Dummies - Andy Harris [259]

By Root 1396 0
Foundation‘,‘linus@gnuWho.org‘

‘4‘,‘Andy Harris‘,‘Wiley Press‘,‘andy@aharrisBooks.net‘

The CSV format often uses commas and single quotes, so if these characters appear in your data, you may encounter problems. Be sure to test your data and use some of the other delimiters if you have problems.

♦ MS Excel and Open Document Spreadsheet: These are the two currently supported spreadsheet formats. Exporting your data using one of these formats gives you a spreadsheet file that you can easily manipulate, which is handy when you want to do charts or data analysis based on your data. Figure 2-17 shows an Excel document featuring the contact table.

♦ Word-processing formats: Several formats are available to create documentation for your project. Figure 2-18 shows a document created with this feature. Typically, you use these formats to describe your format of the data and the current contents. LaTeX and PDF are special formats used for printing.

Figure 2-17: This Excel spreadsheet was automatically created.

Figure 2-18: Word-processing, PDF, and LaTeX formats are great for documentation.

Exporting SQL code

One of the neatest tricks is to have phpMyAdmin build an entire SQL script for re-creating your database. Figure 2-19 shows the available options.

The resulting code is as follows:

-- phpMyAdmin SQL Dump

-- version 2.9.2

-- http://www.phpmyadmin.net

--

-- Host: localhost

-- Generation Time: Dec 08, 2007 at 12:15 PM

-- Server version: 5.0.33

-- PHP Version: 5.2.1

--

-- Database: ‘xfd‘

--

-- --------------------------------------------------------

--

-- Table structure for table ‘contact‘

--

CREATE TABLE ‘contact‘ (

‘contactID‘ int(11) NOT NULL auto_increment,

‘name‘ varchar(50) collate latin1_general_ci default NULL,

‘company‘ varchar(30) collate latin1_general_ci default NULL,

‘email‘ varchar(50) collate latin1_general_ci default NULL,

PRIMARY KEY (‘contactID‘)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=5 ;

--

-- Dumping data for table ‘contact‘

--

INSERT INTO ‘contact‘ VALUES (1, ‘Bill Gates‘, ‘Microsoft‘, ‘bill@msBob.com‘);

INSERT INTO ‘contact‘ VALUES (2, ‘Steve Jobs‘, ‘Apple‘, ‘steve@rememberNewton.com‘);

INSERT INTO ‘contact‘ VALUES (3, ‘Linus Torvalds‘, ‘W3C‘, ‘linus@gnuWho.org‘);

INSERT INTO ‘contact‘ VALUES (4, ‘Andy Harris‘, ‘Wiley Press‘, ‘andy@aharrisBooks.net‘);

You can see that phpMyAdmin made a pretty decent script that you can use to re-create this database. You can easily use this script to rebuild the database if it gets corrupted or to copy the data structure to a different implementation of MySQL.

Generally, you use this feature for both purposes. Copy your data structure and data every once in a while (just in case Godzilla attacks your server or something).

Figure 2-19: You can specify several options for outputting your SQL code.

Typically, you build your data on one server and want to migrate it to another server. The easiest way to do so is by building the database on one server. You can then export the script for building the SQL file and load it into the second server.


Creating XML data

One more approach to saving data is through XML. phpMyAdmin creates a standard form of XML encapsulating the data. The XML output looks like this:

1

Bill Gates

Microsoft

bill@msBob.com

2

Steve Jobs

Apple

steve@rememberNewton.com

3

Linus Torvalds

W3C

Return Main Page Previous Page Next Page

®Online Book Reader