It looks like you already have all the pieces... I'm not exactly sure what you're having a problem with. If the directory matches whats in the DB, you could just do an index on the path column in the DB data, do 1d array search on the path, then select the entire row out of the 2D DB data for display.