FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


manually input to sql database





olek87
hey!

i have a question: does anybody know how to insert datasets to a sql (mysql) database?
i have an adress book (outlook, think its the .csv thing) and want to ad the email adresses to my newsletter on my site wich stores them in a sql database.
so is it possible and, if yes how, to add the adresses through a batchfile, or so, without have to copy paste them on the site?

thanks for the answeres, greetings!
rayxzero
You should extract the data from batchfile and convert it into a sql query (INSERT method). You will need a program to that for you.
jmraker
The SQL command can look like, but if there's too many records the command might fail until you start a new INSERT after a few dozen records.

Code:
INSERT INTO `table_name` (`field_key`, `field1`, `field2`, `field3`) VALUES
(1, 'rec1_val1', 'rec1_val2', 'rec1_val3'),
(2, 'rec2_val1', 'rec2_val2', 'rec2_val3'),
(3, 'rec3_val1', 'rec3_val2', 'rec3_val3'),
(4, 'rec4_val1', 'rec4_val2', 'rec4_val3'),
(5, 'rec5_val1', 'rec5_val2', 'rec5_val3');


or if you want to add records one at a time.
Code:
INSERT INTO `table_name` (`field_key`, `field1`, `field2`, `field3`) VALUES
(1, 'rec1_val1', 'rec1_val2', 'rec1_val3');
INSERT INTO `table_name` (`field_key`, `field1`, `field2`, `field3`) VALUES
(2, 'rec2_val1', 'rec2_val2', 'rec2_val3');
Related topics
SQL
FAQMasterFlex log in trouble
Importing an existing database...
SQL and PHP
Direct Admin problem
Can I create many SQL database by my self
sql with phpmyadmin
Trying to move SQL database
News system with mySQL database.
Database connection class!
How to move SQL database to new domain?
Move database to different SQL server
English Dictionary in text file or sql database
PHP website with SQL Database.
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.