Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Two Docs - trying to save myself three months of work.

Keep it short and simple.

Doc 1 is a list of names and artists, it looks like this -

[Image: MBPNt4s.png]


Doc 2 is a list of names and artists, it looks like this -

[Image: EBGQobz.png]

I need to cross reference these. If Doc 1 has something that doc 2 doesn't, I need a flag. Vice Versa.

Any way to do this? I've been doing it by hand. It's 2400 songs long and it'll take months if I don't find a work around..

note: doc 1 is also a mysql database, if that helps any.

9% BTC > PP or PP > BTC
Why not just run a loop against them using PHP? It won't be hard, especially if doc 2 is a text file.

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.
(Mar 13, 2018 08:51 AM)Nachfolger Wrote:  Why not just run a loop against them using PHP? It won't be hard, especially if doc 2 is a text file.

Not incredibly skilled with php, got a tut for something like this or some pointers?

9% BTC > PP or PP > BTC
(Mar 13, 2018 09:51 AM)Honeybun Wrote:  Not incredibly skilled with php, got a tut for something like this or some pointers?
Sure. Start with grabbing everything from the database, then use a loop to check if the line from the DB is in the text file.

PHP Code

<?php
// Doc 1
$doc1 = Array(); // Grab the DB lines
// Doc 2
$file = file_get_contents('somefile.txt');

// Loop through DB 
foreach($doc1 as $line) {
 
$pattern = "/^.*$pattern.*\$/m";
 if(!
preg_match_all($pattern, $file, $line)){
    echo 
"<br>Document 2 does not contain " . $line;
 }
} 
Taken and modified from https://stackoverflow.com/questions/3686...whole-line

I'm extremely hungry and my code usually contains errors when I'm hungry so just brace for that. The concept is pretty simple, so just follow it when building the script.

Je t'aime
[Image: fpZ5a5g.png]

(Apr 22, 2022 04:39 PM)-Scrub Wrote:  Jokes on you, I'm not smart enough to know what he's talking about.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by efrappiAug 14, 2016 01:13 PM 0 637 Aug 14, 2016 01:13 PM
Last Post: efrappi
by NutarJun 28, 2014 03:23 PM 4 122 Jun 28, 2014 03:23 PM
Last Post: Nutar
by blackhatboyAug 27, 2012 03:06 AM 3 1,396 Aug 27, 2012 03:06 AM
Last Post: Hercules.