SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2005
    Posts
    527
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    multy field form

    I am creating a multi field form that have some textboxes and radios and ...
    this form should select from a table (search) like a friend finder with this fields : age : sex : location and ...
    you should fill a field at least ,

    this form can have diffresnts forms like :

    select * from users where sex=mail and age<23
    or select * from users where age<23 and location=uk
    and ...

    How I can make this queries ?

  2. #2
    SitePoint Wizard silver trophy Jelena's Avatar
    Join Date
    Feb 2005
    Location
    Universum, 3rd Corner
    Posts
    3,000
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $sql "SELECT * FROM users";
    $sql .= " WHERE 1<2";
    if(isset(
    $sex) && $sex != "")
    {
      
    $sql " AND sex = '".$sex."'";
    }

    if(isset(
    $age) && $age != "")
    {
      
    $sql " AND age < '".$sex."'";
    }
    //etc..etc.. 
    -- Jelena --


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •