macromedia.coldfusion.database_access
[Top] [All Lists]

query a search query

Subject: query a search query
From: "cybertek23" <webforumsuser@xxxxxxxxxxxxxx>
Date: Tue, 29 Jan 2008 15:44:50 +0000 (UTC)
Newsgroups: macromedia.coldfusion.database_access

Hi i am doing a site where clients can do a seach based on caseworker name. i 
need to get the information from 2 tables.



 [i]<cfquery name="caseworker2" datasource="webconveyancer" 
dbtype="ODBC">select caseworkerid from caseworker
 where caseworkername  like '#choose#%'
 </cfquery>[/i] 

 I then use a CF loop to get the information

 [i]<cfloop query="caseworker2">


 <cfquery name="searchall" datasource="webconveyancer" dbtype="ODBC">
 select * from clientdetails
 where solicitorid=#solicitorid#
 and caseworkerid = #caseworker2.caseworkerid#
 order by clientsurname
 </cfquery><cfoutput query="searchall">[i]

 I then need it to display the results.I need it to use the caseworker id and 
broker id from the clientdetails tabel to match to the caseworker id and broker 
id in there respective tables. I have done this like this.

 [i] <cfoutput query="searchall">  <tr> 
                         <td><a 
href="viewclient2.cfm?solicitorid=#solicitorid#&clientid=#clientid#&lnr=#lnr#&ch
oose=#choose#">#clientid#</a></td>
                         <td>#transaction#</td>
                         <td>#clientsurname# #clientfirstname#</td>
                         <td>#clientaddress1#</td>
                       </cfoutput> 
                       <td><cfquery name="caseworker"  
datasource="webconveyancer" dbtype="ODBC">
                         select caseworkername from caseworker where 
caseworkerid=#searchall.caseworkerid# 
                         </cfquery> <cfoutput 
query="caseworker">#caseworkername#</cfoutput></td>
                       <td><cfquery name="broker"  datasource="webconveyancer" 
dbtype="ODBC">
                         select brokername from broker where 
brokerid=#searchall.brokerid# 
                         </cfquery> <cfoutput 
query="broker">#brokername#</cfoutput></td>
 [i]
 The problem  is that more that 1 client can have the same caseworker and if 
the caseworker has been shown it will not reshow it. 

 Anyideas onhow i can fix this.


<Prev in Thread] Current Thread [Next in Thread>