troubleshooting Question

strpos VS mysql_query

Avatar of Khanh Doan
Khanh DoanFlag for United States of America asked on
PHP
2 Comments1 Solution586 ViewsLast Modified:
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
ASKER CERTIFIED SOLUTION
Richard Davis
Senior Web Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros