Khanh Doan
asked on
strpos VS mysql_query
Now I have a text file that have about 1 milion lines. Each line have about 100-150 chars, start with a md5 str. In database have about over 1 milion row, now I need to check that which row is NOT IN text file, and then remove it.
My friend told me use this method:
- set a check-field to false
- query 1 milion lines from text file to db, set true to that row
- and then run a query that remove every row that have check-field = false.
But I'm now currently using follow method:
- query all database, insert into variable
- loop through variable and use strpos() to check that row have in text file or not; if not run query remove it
I dont know which method is better ?
Thanks for reading and sorry about my bad English.
Bonmat86
My friend told me use this method:
- set a check-field to false
- query 1 milion lines from text file to db, set true to that row
- and then run a query that remove every row that have check-field = false.
But I'm now currently using follow method:
- query all database, insert into variable
- loop through variable and use strpos() to check that row have in text file or not; if not run query remove it
I dont know which method is better ?
Thanks for reading and sorry about my bad English.
Bonmat86
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER