dilbertone Posted January 15, 2011 Share Posted January 15, 2011 Hi dear freaks i want to create an adressbook with MySQL. At the moment i do not know how many fields i need. i want to be flexible with that - at least in the next days... Untill i am sure how many fields i really would need. i have found a Dump that allready is build for a Adressbook - i found this one in the internet. http://www.apachefriends.org/f/viewtopic.php?f=14&t=26305&start=0&sid=633a3f317b08dc6d8e555a81ed10538f&view=print # phpMyAdmin SQL Dump # version 2.5.7-pl1 # http://www.phpmyadmin.net # # Host: localhost # Erstellungszeit: 04. September 2007 um 16:37 # Server Version: 4.0.20 # PHP-Version: 4.3.7 # # Datenbank: `joels` # # -------------------------------------------------------- # # Tabellenstruktur f�r Tabelle `address_book` # CREATE TABLE `address_book` ( `address_book_id` int(11) NOT NULL auto_increment, `customers_id` int(11) NOT NULL default '0', `entry_gender` char(1) NOT NULL default '', `entry_company` varchar(32) default NULL, `entry_firstname` varchar(32) NOT NULL default '', `entry_lastname` varchar(32) NOT NULL default '', `entry_street_address` varchar(64) NOT NULL default '', `entry_suburb` varchar(32) default NULL, `entry_postcode` varchar(10) NOT NULL default '', `entry_city` varchar(32) NOT NULL default '', `entry_state` varchar(32) default NULL, `entry_country_id` int(11) NOT NULL default '0', `entry_zone_id` int(11) NOT NULL default '0', PRIMARY KEY (`address_book_id`), KEY `idx_address_book_customers_id` (`customers_id`) ) TYPE=MyISAM AUTO_INCREMENT=2 ; can i use this - and can i easily add more fields... ? lookforward to hear from you Regards db1 Quote Link to comment https://forums.phpfreaks.com/topic/224533-adressbook-how-to-add-more-fileds-to-this-one/ Share on other sites More sharing options...
BlueSkyIS Posted January 15, 2011 Share Posted January 15, 2011 you can add more fields to any table you like. perhaps i don't understand the question? Quote Link to comment https://forums.phpfreaks.com/topic/224533-adressbook-how-to-add-more-fileds-to-this-one/#findComment-1159810 Share on other sites More sharing options...
dilbertone Posted January 15, 2011 Author Share Posted January 15, 2011 Hi there - hello BlueSkyIS you can add more fields to any table you like. perhaps i don't understand the question? Well - what if i want to migrate 10 (Adressbook-)DBs into one. They look a bit different: Adressbook 1: name adress eMail tel Telefax portrait Adressbook 2: name Company aresss: postalcode Telefon: Fax: E-Mail: Internet: Adressbook 3: name address tel fax email homepage all ten look like a bit different. How to treat this migration of ten tables into one big DB!? Hope i was able to make clear what i want. If i have to be more precise - just lemme know Many thanks in advance regards db1 Quote Link to comment https://forums.phpfreaks.com/topic/224533-adressbook-how-to-add-more-fileds-to-this-one/#findComment-1159814 Share on other sites More sharing options...
ignace Posted January 15, 2011 Share Posted January 15, 2011 UNION INSERT INTO addressbook (name, address, email tel, fax) VALUES (SELECT name, address, email, tel, telefax FROM addressbook1) UNION ALL (SELECT name, company adress, email, telefon, fax FROM addressbook2) UNION ALL .. Quote Link to comment https://forums.phpfreaks.com/topic/224533-adressbook-how-to-add-more-fileds-to-this-one/#findComment-1159844 Share on other sites More sharing options...
dilbertone Posted January 16, 2011 Author Share Posted January 16, 2011 Hello Ignace many many thanks for the idea - that sounds very very good., BTW; As i already have the addresses in tab separated format What aobut this: I can create 10 different tables (or less according to the different formats) and loaf the into the database using load data infile command MySQL :: MySQL 5.1 Reference Manual :: 12.2.6 LOAD DATA INFILE Syntax .After this i can used the commands posted by you to create a new table with your new address book format. what do you think about this! look forward to hear from you best db1 see also: http://dev.mysql.com/doc/refman/5.1/en/load-data.html Quote Link to comment https://forums.phpfreaks.com/topic/224533-adressbook-how-to-add-more-fileds-to-this-one/#findComment-1160275 Share on other sites More sharing options...
ignace Posted January 16, 2011 Share Posted January 16, 2011 Why would you need 10 tables? One should suffice. Using LOAD DATA you can load the data from the CSV to your table. LOAD DATA INFILE INTO TABLE addressbook (name, address, email, tel, fax) COLUMNS TERMINATED BY '\t' LINES TERMINATED BY '\r\n' Quote Link to comment https://forums.phpfreaks.com/topic/224533-adressbook-how-to-add-more-fileds-to-this-one/#findComment-1160280 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.