Quite simple:
in the PHP script that is called upon submission, you check
which field is filled in, and then do your select...
the if-then-else statement does not belong into the SQL, but
rather in the program querying your database, since that
has the business logix...

Cheers,
Guus

>  -----Original Message-----
>  From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>  Sent: Wednesday, September 12, 2001 8:14 PM
>  To: [EMAIL PROTECTED]
>  Subject: Urgent Assistance
>  
>  
>  Hi group,
>  
>  I am in need of assistance with a database and php query we 
>  are trying to 
>  achieve.
>  
>  Basically we are have a form where one field searches a 
>  field in the mysql 
>  database and the other searches for keywords using the MATCH query.
>  
>  What we need to do is for the user to be able to enter a 
>  date or keyword and 
>  for it to query the database. Is it possible to do alternate 
>  queries based 
>  upon what the user is entering. So we would like to be able 
>  to do a sql 
>  elseif statement, but I am unsure if this is possible. 
>  
>  Here is out current code:
>  $sql= "SELECT *, MATCH (auction, email, website) AGAINST 
>  ('$keywords') AS 
>  score FROM ukcalendars WHERE date = '$date' HAVING score != 
>  0 ORDER BY score 
>  ASC LIMIT $limitvalue1, $limit";
>  
>  But we need to be able to also do:
>  
>  $sql= "SELECT * FROM ukcalendars WHERE  date = '$date' LIMIT 
>  $limitvalue1, 
>  $limit";
>  
>  But I am unsure how I can achieve this, if at all possible.
>  
>  With thanks
>  
>  
>  barry Zimmerman
>  www.bzdpltd.co.uk
>  
>  ---------------------------------------------------------------------
>  Before posting, please check:
>     http://www.mysql.com/manual.php   (the manual)
>     http://lists.mysql.com/           (the list archive)
>  
>  To request this thread, e-mail <[EMAIL PROTECTED]>
>  To unsubscribe, e-mail 
>  <[EMAIL PROTECTED]>
>  Trouble unsubscribing? Try: 
>  http://lists.mysql.com/php/unsubscribe.php
>  

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to