{{indexmenu_n>20}} ====== Export/import a guestbook ====== How to export/import all the entries from a guest book from one db into another? //(first into second)// If there is an empty table "phpwcms_guestbook" in your target db: ===== Export from first db: ===== Export only the table "phpwcms_guestbook" and its data into a file {{:english:technics:database:phpwcms_guestbook:table_export01.gif|}} \\ ===== Generated sql file (example) ===== -- phpMyAdmin SQL Dump -- version 3.1.3.1 :!:-- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Oct 09, 2009 at 09:26 -- Server version: 5.1.30 -- PHP Version: 5.2.9 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; -- -- Database: `my_database_name` -- -- -------------------------------------------------------- -- -- Table structure for table `phpwcms_guestbook` -- CREATE TABLE IF NOT EXISTS `phpwcms_guestbook` ( `guestbook_id` int(11) NOT NULL AUTO_INCREMENT, `guestbook_cid` int(11) NOT NULL DEFAULT '0', `guestbook_msg` text NOT NULL, `guestbook_name` text NOT NULL, `guestbook_email` text NOT NULL, `guestbook_created` int(11) NOT NULL DEFAULT '0', `guestbook_trashed` int(1) NOT NULL DEFAULT '0', `guestbook_url` text NOT NULL, `guestbook_show` int(1) NOT NULL DEFAULT '0', `guestbook_ip` varchar(20) NOT NULL DEFAULT '', `guestbook_useragent` varchar(255) NOT NULL DEFAULT '', `guestbook_image` varchar(255) NOT NULL DEFAULT '', `guestbook_imagename` varchar(255) NOT NULL DEFAULT '', PRIMARY KEY (`guestbook_id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ; -- -- Dumping data for table `phpwcms_guestbook` -- INSERT INTO `phpwcms_guestbook` (`guestbook_id`, `guestbook_cid`, `guestbook_msg`, `guestbook_name`, `guestbook_email`, `guestbook_created`, `guestbook_trashed`, `guestbook_url`, `guestbook_show`, `guestbook_ip`, `guestbook_useragent`, `guestbook_image`, `guestbook_imagename`) VALUES (1, 10, 'TestText01', 'Sir Oblong-Fitz-Oblong', 's-o-f-o@example.com', 1251067220, 9, '', 2, '123.345.678.91', '7ee43b2c7cd249376343fc94081bc839', '', ''), (2, 10, 'TestText02', 'Sir Oblong-Fitz-Oblong', 's-o-f-o@example.com', 1251067266, 0, '', 2, '123.345.678.91', '7ee43b2c7cd249376343fc94081bc839', '', ''), (3, 10, 'TestText03', 'Sir Oblong-Fitz-Oblong', 's-o-f-o@example.com', 1251067512, 0, '', 2, '123.345.678.91', '7ee43b2c7cd249376343fc94081bc839', '', ''), (4, 10, 'TestText04', 'Sir Oblong-Fitz-Oblong', 's-o-f-o@example.com', 1253269013, 0, '', 2, '123.345.678.92', '52a2b8d1b5080327501e101b5d3c1d55', '', ''), (5, 10, 'TestText05', 'Sir Oblong-Fitz-Oblong', 's-o-f-o@example.com', 1254779030, 0, '', 2, '123.345.678.92', '52a2b8d1b5080327501e101b5d3c1d55', '', ''); Open the sql file with a ascii editor and have a closer look to: -- Database: `my_database_name` ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 and change it to your needs. :!: **AUTO_INCREMENT** must be set to **n+1** //(last number of guestbook_id +1)// :!: If you havenĀ“t a empty target db, please have a look into for the value of **AUTO_INCREMENT**. In your generated sql file the numbering of the column guestbook_id must begin with this value!! All following entries must be nummeriert ascending. \\ Set **AUTO_INCREMENT** to **n+1** //(last number of guestbook_id +1)//. \\ ===== Import into the second db (target) ===== Import this file into the target db {{:english:technics:database:phpwcms_guestbook:table_import01.gif|}} ===== Result in target db ===== {{:english:technics:database:phpwcms_guestbook:table_browse03.jpg?860|}} **guestbook cp:** \\ You find the associated **alias-ID** of a guestbook in the db table column **guestbook_cid**. \\ The **alias-I**D in your guestbook cp must be the same like the ID in the db table column **guestbook_cid**. \\ If in the db table column **guestbook_cid** more then one ID exist, you have more then one guestbook in several contentparts. ===== guestbook content part ===== {{:english:technics:database:phpwcms_guestbook:guestbook_cp01.gif|}}