In the case of computers in Malahide, we will end up calling makewherequery(), which is 
defined in dbq.inc. This function takes three parameters, $what, $where and $sortby.  
Fig. 3: The makewherequery() function, one of four which generate different SQL queries 
   $sortby may or may not be set in the original HTTP request. If it is not explicitly set 
then, it will be assigned the value  default .  
   If $sortby is set to either  shop  or  picfile  (the field in the clients table containing 
the location of a picture ad), we would prefer MySQL to sort the results in descending 
order,  so  that  the  businesses  with  a  shop/picture  ad  appear  at  the  top  of  the  list. 
Otherwise, the results should come back in normal ascending alphanumerical order. 
   The 
resultant 
MySQL 
query 
(in 
English) 
then 
goes 
as 
follows:  
 Select all rows from the clients table where either  bizname` or  pictext` contain the 
string   computer   and  any  of  the  address  fields  contain  the  value   malahide .  Sort 
these results in ascending order . 
A more complicated scenario as far as constructing these SQL queries arises if the user 
has decided to search within a particular area code and the adjacent areas. In this case, 
$searchby is set to  areacode , $yourarea is set to some area code and $radius is set to 
 adjarea   (the  other  option  is   thisarea ).  For  this  example,  let us  take  $yourarea  to  be 
 021 , and we are searching for a  plumber . 
Thus,  makeareaquery()  is  called.  The  first  part  of  its  output,  dealing  with  $what  is  the 
same, but in order to find all of the relevant businesses in the adjacent areacodes too, it is 
first necessary to query the areacode table in the getadj() function  
32




  

Home

About Services Network Support FAQ Order Contact
 

Web Hosting Apache

Our partners:Jsp Web Hosting Unlimited Web Hosting Cheapest Web Hosting  Java Web Hosting Web Templates Best Web Templates PHP Mysql Web Hosting Interland Web Hosting Cheap Web Hosting PHP Web Hosting Tomcat Web Hosting Quality Web Hosting Best Web Hosting  Mac Web Hosting 

Lunarwebhost.net  Business web hosting division of Vision Web Hosting Inc. All rights reserved