Search and Replace within a Text file using mySQL queries

Posted by user241000 on Stack Overflow See other posts from Stack Overflow or by user241000
Published on 2010-05-16T14:25:20Z Indexed on 2010/05/16 14:30 UTC
Read the original article Hit count: 347

Filed under:
|

How can I create PHP to search the testing.txt file for each name in the database table and replace the name with the database table id?

So that the text file looks like this:

3 | 1 | 4 | 5
2 | 3 | 6
4 | 5 | 2
and so forth an so on...

I have a mysql table called "nameslist" that looks like this:

---------------------
id | name
---------------------
1  | bob
2  | john
3  | tom
and so forth an so on...

I have a text file called "testing.txt" that looks like this:

tom | bob | mary | paul
john | tom | rachel
mary | paul | john
and so forth an so on...

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql