Read a text file and transfer contents to mysql database

后端 未结 4 981
终归单人心
终归单人心 2020-12-15 12:53

I need a php script to read a .txt file.

The content of the text file are like this:

data.txt

145|Joe Blogs|17/03/1954
986|Jim          


        
4条回答
  •  佛祖请我去吃肉
    2020-12-15 13:41

    @Anthony Forloney Your answer is right,just add the vertical bar[ | ] at each very last of each row like this on your data.txt file...enter image description here

    and rest is same as in your answer.This is working for me...

    dont forget to add the quotes for varchar type for inserting datas to table....

提交回复
热议问题