what=computer
&searchby=location
&where=malahide
&yourarea=01
&radius=thisarea
&sortby=default
Fig. 2: Detail of a typical query string and the corresponding form values
Each of the variables correspond to an element of the form above, and the two most
logically important ones are $what and $searchby.
$what must be set: its value is what will be compared against a list of categories and a
list of business names. Any businesses whose names or categories, which contain, in
this case, the string computer , will be included in the results table.
$searchby is derived from the pair of radio buttons in the form; it will always be set to
either location or areacode and this is what decides how the SQL query is to be
generated. A number of functions are defined in dbq.inc: makareaquery(),
makecatareaquery(), makewherequery() and makecatwherequery().
If $searchby == location , we are then only concerned with the variables $what,
$where and $sortby and we call makewherequery().
If $searchby == areacode , we are only concerned with the variables $what,
$yourarea, $radius and $sortby and we call makeareaquery().
Finally, if the $cat variable is set (this will only happen after a user has clicked on a
category in the Related categories panel), there exist two further functions,
makewherequery() and makecatwherequery(), to additionally filter out only those
businesses with the matching category id in the clients table of the database.
31