Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
| Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To 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 March 1st, 2005, 02:20 PM
nav nav is offline
Registered User
 
Join Date: Aug 2004
Location: halsowen, , United Kingdom.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Importing data from a text file

Hi,

I need some help trying to import data from a text file which is to be inserted into a mysql database.

I need to do this through php but i have no idea of how to do this.

Any help would be much great!

 
Old March 4th, 2005, 07:30 AM
Authorized User
 
Join Date: Feb 2004
Location: Karachi, , Pakistan.
Posts: 81
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to knight
Default

The LOAD DATA INFILE command is used to rapidly load data from external text files in MySQL. You should read http://www.mysql.com/documentation/m...html#LOAD_DATA

and
try

mysql> USE db1;
mysql> LOAD DATA INFILE 'data.txt' INTO TABLE db2.my_table;

Hope this helps. As long as your text data is formatted sensibly (eg: tab or comma delimited or something similar) it should be no problem.

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



 
Old March 7th, 2005, 02:42 PM
nav nav is offline
Registered User
 
Join Date: Aug 2004
Location: halsowen, , United Kingdom.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for that information.

I have successfully entered the data from the text file.





Similar Threads
Thread Thread Starter Forum Replies Last Post
importing text file into excel stealthdevil Excel VBA 2 July 10th, 2007 11:28 AM
Text file importing & data processing jarpola Excel VBA 0 January 16th, 2007 10:27 AM
Importing a text file DBN Beginning VB 6 6 April 24th, 2006 02:52 PM
Problem importing text file manuel Access 3 April 7th, 2004 09:36 AM
BCP error while importing data from a text file happygv SQL Server ASP 1 December 15th, 2003 09:16 AM





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