in reply to database query matching

In your particular situation, the best idea may be to use some sort of relational database (MySQL, mSQL, or any non-free ones if you can afford them...). At the best, you'd be re-inventing the wheel doing it yourself. In addition to structuring the flatfile database, you'd have to also do things such as index those 3 fields for fast lookups and efficient sorts.. Basically, doing things that the authors of databases have spent much time optimizing. If you are able to install software on the server, and/or can get someone to do it for you, MySQL is the best free way to go. If you are restricted to using flat-file databases, you'll probably want to do something like just a comma or tab delimited file, but a good amount of time will be spent making your searching methods efficient.