Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-11-2009
Member
 
Join Date: Oct 2009
Posts: 2
Search text in database using Coldfusion

I am developing a program that will search for multiple words in the database. My code should search for one word or if there is a perfect match of multiple words. i mean if i have database rows as
1. Flash Player
2. Adobe Flash Player
then the code displays both for the search "flash Player", but when i search for "Adobe Player" then too it should display the same result, which my program code does not do. Anyone help me please.
Reply With Quote
  #2  
Old 05-11-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: Search text in database using Coldfusion

Would like to see what actually your code looks like, and what data is it that yo are going to use and the result you are trying to get. Also did you try breaking the url.name into small pieces and then use LIKE to search for each piece.?


You don't explain enough about what the data looks like and the result you are trying to get. But couldn't you break the url.name into pieces based on spaces and then select LIKE for each piece?
Reply With Quote
  #3  
Old 05-11-2009
Member
 
Join Date: Oct 2009
Posts: 2
Re: Search text in database using Coldfusion

Here's what i did.
Code:
<cfparam name="URL.NAME" default="1" type="Any">
<cfquery name="search" datasource="datasource">
SELECT * FROM search WHERE NAME LIKE ="%#URL.NAME#%"ORDER BY DATE
</cfquery>
Still i am trying what you said, will post what i get.
Reply With Quote
  #4  
Old 05-11-2009
Member
 
Join Date: Apr 2008
Posts: 2,001
Re: Search text in database using Coldfusion

Code:
<cfparam name="searchStr" default=" ">
<cfparam name="newArrayList" default=" ">
<cfset newArrayList=ArrayNew(1)>
<cfif isdefined("form.searchItems") AND form.searchItems neq "">
	<cfset searchStr = #trim(form.searchItems)#>
	<cfset searchstr = #lcase(searchStr)#>
	 <cfif searchstr contains " "> 
	 	<cfset searchStr = Replace(searchStr," ",",")>
		<cfset newArrayList = ListToArray(searchstr)>
		<cfif newArrayList[1] neq "">
			<cfset item1 = #newArrayList[1]#>
		</cfif>
		<cfif searchstr contains ",">
			<cfset item2 = #newArrayList[2]#>
		</cfif>
	 </cfif>
</cfif>
Try using this code, where i have broken it into two elements and then put them into an array. In case of any further assistance , please do post here.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Search text in database using Coldfusion"
Thread Thread Starter Forum Replies Last Post
Universal Search not finding/showing certain search results, especially text messages in blackberry torch Tiger Memon Portable Devices 5 10-10-2010 04:30 AM
Search Access Database in Windows XP Doroteo Windows Software 3 04-11-2009 11:19 PM
I need a search function for my access database. Superstar9 Windows Software 3 02-09-2009 11:33 PM
How to update two database tables coldfusion Rixwel Software Development 3 10-08-2009 03:13 PM
Search Companion text search folder doesn't find all files Hrishia Windows XP Support 2 27-11-2008 10:16 PM


All times are GMT +5.5. The time now is 12:05 PM.