...

View Full Version : Search by related fields



lebronletchev
02-09-2007, 03:32 PM
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

Baleric
02-11-2007, 09:58 PM
you can use Instr() to look inside a string

apply like this



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




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)

lebronletchev
02-12-2007, 10:27 AM
Thank you.

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

Thanks

LeBRON LeTCHEV



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum