Originally posted by laserlight
Use some way to obtain the criterion from the user, e.g. a drop down menu.
Then SELECT fieldname FROM tablename, where the fieldname corresponds to the criterion chosen.
Thank you. I understand how the query works, but I cant understand quite how to plugin the variables without generating an error. For Example:
There are fields 1,2,3,4,5,6,7,8,9 and the user wants to select records matching only fields 1,3,5. I would use SELECT * FROM database WHERE .... = 1 AND ...=3 AND ...=5.
But if the user chooses to query only 1,5 am I not then left with an extraneous 'AND' statement? It is difficult to explain but I am being as clear as I possible can. It is sort of like an advanced search on Yahoo or Google where one may select multiple search criteria.
ThanX