php - how to take out the first 5 characters in each line? -


I have a text file inside the file that I have

  22222 33333 hihi kjhkh Hihihi   

I want to write an application to compare mysql database so that if my id is similar to the first column in the text file in the database, This will update the data by changing the name with the information in the second column in the text file.

How can I do this?

As you mentioned above that the fields are separated by a tab, you can import the file directly into MySQL (Believe that the ID is the primary key of that table):

  Load data INFILE 'data.txt' to table table (ID, name);   

(Note: this will not only update but will also add entries)

Comments