Quote:
Originally Posted by markster
i have a database of products
|
What kinda of a database? A MySQL database? sqlite? Postgresql? Oracle? If you have a relational database then you can use DJMaze's SQL (Structured Query Language) statement. PHP has support for SQL to access a number of databases.
Otherwise, as with a flat-file, you can look up any number of search algorithms online.
Be careful with accepting input from a user to search any database. If you directly run the search with input from the user then they can inject extra SQL into your search. These extra commands can possibly run any SQL operation on your database that your PHP system can, including deleting the whole database. Some database utility libraries may offer to handle this for you, like prepared statements, or completely ignore it forcing you to write security code directly into your application.