Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search -> in database

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

my users can do a full search on the content of my website, which is stored in a database.

But the search will searchin different tables, how do I manage to print out the correct content, cq. tablename?

Let's say I've a database table called:

Customers -> Fields [name, address]
Newsarticles -> Fields [title, article]

When I perform a search on these two tables, and a result is found, how do I know which field to output?

If the keyword is found in the 'title' it should display the title.


Hope you can help me out;

bram
 
How do you have your query set up? Are you doing multiple queries or joining them together?

You can use a cfif when you output it to see if the field is blank:

e.g
<cfquery name=&quot;SearchQry&quot;>
Select Name,Address from Customers
</cfquery>
<cfoutput query=&quot;SearchQry&quot;>
<cfif Name is NOT &quot;&quot;>
Keword found in &quot;Name&quot; field
</cfif>

<cfif Address is NOT &quot;&quot;>
Keyword found in Address
</cfif>


</cfoutput>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top