Quick Php/mysql Lookup Script

Hi, I have a file of 20000 records that looks like this.
id,category,rank,desc,url,baseurl
“aaa123″,”Category a”,”1″,”description a”,http://www.aaa.tv/a.html,http://www.aaa.tv
“bbb123″,”Category b”,”2″,”description b”,http://www.bbb.tv,http://www.bbb.tv
“ccc123″,”Category c”,”3″,”description c”,http://www.ccc.com/c.html,http://www.ccc.com
“ddd123″,”Category d”,”4″,”description d”,http://www.ddd.com,http://www.ddd.com
“eee123″,”Category e”,”5″,”description b”,http://stream-eee.com,http://stream-eee.com

I need someone to write a quick php/mysql file that looks up the url (not the baseurl) in the list and returns the id and then redirects to a new link with the id.

An example:
I will call the script
www.test.com/?keyword=bbb.tv (<-bbb.tv = url)

The script will look up bbb.tv in the database and return with the id value and redirect to
bbb.tv?id=bbb123 (<- bbb123 = id)

This is a simple project but I expect the following
1. An import.sql file to create the database/table in mysql and add the data listed above. This should also create whatever indexes are needed for fast lookups.

2. A redirect.php file that handles the redirect. This will handle a lot of traffic so I want it as fast and optimized as possible.

Leave a Reply

Your email address will not be published.