Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to populate MYSQL database with data from text file ?

Status
Not open for further replies.

c0deM0nK424

Programmer
Oct 28, 2007
126
GB
have a text file in the format of


item1
item2
item3
item4
" "
" "
item 999



which i need to pull these items out of and populate my MySQL database with.


The database has GAME_ID (Primary key field) , GAME_TITLE, YEAR, PUBLISH as fields - and i am simply wishing to populate the GAME_TITLE column.

any ideas on how to go abouts doing this ?

i want to do this inside phpmyadmin btw folks.


provided a screenshot of the txt file (opened containing the values), its just an alphabetical list of games (0-9 and A-Z)

 
Sadly the LOAD DATA INFILE does not offer the on DUPLICATE KEY UPDATE feature, however, you can use the IMPORT option from phpmyadmin to import the file to a temporary table, and then use an update statement to get the values from there and update your other table.




----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top