|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
I am wondering how I would implement a search when a field from a form is filled in incompletely. Say, when searching for a first or last name, the person only puts in the first two letters of that last name. How would I do SQL/Cold Fusion code so that the search would display/give back the names that match up based on the one/two or whatever letters the person entered in the form (if it was not complete)???
Thanks...ps my code works so far if you enter the whole thing correctly: SELECT * FROM ALUMNA WHERE 0=0 <cfif Len(Form.fname)>AND FIRSTNAME='#Form.fname#'</cfif> <cfif Len(Form.lname)>AND LASTNAME='#Form.lname#'</cfif> Thanks a bunch - have a great day! |
|
#2
|
|||
|
|||
|
You want to try the LIKE operator in your WHERE clause:
select * from mytable where lastname like '%form.lastname%' Now myhomie, I mentioned this in your previous post. The questions you are asking are covered in the first 50 pages of any SQL book. This is extremely basic stuff. Before you ask any further questions I urge you to read a basic SQL book. I have to say that I'm not going to answer many more of these types of questions because, as I said, they are covered over and over in every SQL book on the market. Try Ben Forta's to start with: http://www.amazon.com/exec/obidos/t...il/-/0672325675
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#3
|
|||
|
|||
|
Quote:
Thanks for your help. |
|
#4
|
|||
|
|||
|
You're welcome man. I'm not trying to be harsh, I'm just trying to let you know that in the long run if you don't learn the basics the only person you're hurting is yourself.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Searching with incomplete entries |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|