I agree more information is needed to answer your question. As I understand it you need to empty a database table and reload it with the information in the text file you received, which sounds like a CSV file that uses pipes instead of commas. Do I have this right?
So you need to...
Step 1 - Get your information out of the text file.
You can try something like fgetcsv() (setting the delimiter to '|'), or you could just use fgets() and use explode() to put the data in an array.
Step 2 - Insert data into your database table
Loop through you data until you have it all in there. If all goes well then...
Step 3 - Delete the old data
It might seem easier to empty the database first, and then add your data. You could do that, but if something goes wrong with the new data then what? Now you're stuck with an empty database table until you fix it. Depending on what this is used for that could be undesirable.