I had a code written long time ago which was working fine for small records but as the number of records begin to increase it completely failed. I am attaching the file with comments which will help you understand the problem.
For fewer records you can see it working at http://dssln.info/search_logistic_providers.php
For large records you can see its behaviour at http://216.14.120.171/search_logistic_providers.php
Basically this code depends on three tables
1) transport
2) services
3) servinv
transport table contains detail of different transport companies and has about 20,000 records
services table stores different services which can be provided by transporters and has 235 records
servinv maps each transporter to each service and tells whether a specific transporter offer this service
or not and it has about 4,233,841 records.
My code completely fails to handle such a large number of records so I need some one to help me optimize
my queries to make it work