Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2006
    Location
    Spain
    Posts
    147
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool Search by related fields

    Dear friends,



    Dear friends,


    I would need your helpful for the hard task of relationship of diferent fields:


    I have 2 tables:

    table1

    columns

    profession first_name last_name
    (text) (text) (text)

    scientist robert lang
    artist edward savoy
    artist francisco montes


    table2

    description (memofield)

    Peter Paul was the most popular and prolific British football player of the 19th century.
    Robert Lang is an British scientist who is also one of the foremost origami artists and theorists in the world.
    Francisco Montes was a visionary artist.
    This is a picture of Edward Savoy, who accomplished one of the most signal.




    MY PROBLEM:


    1. The user will input the NICKNAME in an input box. Ok?
    2. Normally the asp script would find the NICKNAME in description, HOWEVER I would tie the name of NICKNAME with first_name and last_name. So, the script would need read the name of NICKNAME (input by user), but the script will search the first_name + last_name in DESCRIPTION.

    3. The results will shown all records that contains the first_name + last_name in description memofield!

    Thank you in advance for your collaboration.

    Best

    Lebron LETchev

  • #2
    Regular Coder Baleric's Avatar
    Join Date
    Feb 2005
    Location
    Australia
    Posts
    332
    Thanks
    0
    Thanked 0 Times in 0 Posts
    you can use Instr() to look inside a string

    apply like this


    Code:
    dim Description, Firstname
    Description = rs("description")
    FirstName = rs("FirstName")
    
    
    if instr(Description, Firstname) = 1 then
    response.write Description 
    else
    end if
    
    then do a loop
    to check both firstname and lastname try this

    Code:
    dim Description, Firstname, Lastname
    Description = rs("description")
    FirstName = rs("FirstName")
    Lastname = rs("Lastname")
    
    if instr(Description, Firstname) = 1 and instr(Description, Lastname) = 1 then
    response.write Description 
    else
    end if
    hope this helps (and works)

  • #3
    Regular Coder
    Join Date
    Oct 2006
    Location
    Spain
    Posts
    147
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thank you.

    This helps me! From brick to brick I will build my wall!

    Thanks

    LeBRON LeTCHEV


  •  

    Posting Permissions

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