Jump to content

Text File Into MySql Table


brown2005

Recommended Posts

I have a text file 'Table1' set out like this

 

1 10/5/2008 00:00:00 £51654.00

2 1/1/2008 00:00:00 £51.00

3 1/6/2007 00:00:00 £651.00

4 1/1/2009 00:00:00 £165.00

 

and a MySql table 'invoices'

 

id

date

amount

 

what I want to do is put the details in the text file into my mysql table.. how would I do this please?

 

Link to comment
Share on other sites

The simplest approach would be to write a small program (in PHP or any other language) to read the text file and generate SQL to populate the database, and then execute the script against the database. Similarly the program could directly execute the SQL against the database.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.