Avatar of Khanh Doan
Khanh Doan
Flag for United States of America 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
PHP

Avatar of undefined
Last Comment
Khanh Doan

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Richard Davis

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Khanh Doan

ASKER
Anyone else ? I need advise about this ^^
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23