|
| |
|
|
jonance
Posts: 298 From: Louisville KY USA Status: offline
|
Search without requiring exact phrase - 9/27/2003 22:21:43
Hi, If i have a smple search form to search a column of a database, how can i get it so if someone enters two words, that it will retrieve a result even if that EXACT PHRASE isn't in the title but both words are. For example: If the itemname is "411 The First Step Video" and someone enters '411 video' into my search box, it won't retrieve the record. Apparently it has to be an exact match. How can i change this? Here is my code: SELECT * FROM products WHERE (itemname LIKE '%::search::%') ORDER BY ::SortColumn:: Thanks in advance, John
|
|
|
|
jonance
Posts: 298 From: Louisville KY USA Status: offline
|
RE: Search without requiring exact phrase - 9/28/2003 0:18:40
Thanks, i hope we're on the right track...but i got this error in frontpage. When i went and pasted that in the "edit" portion of the drw, i got the message saying an error was encountered...here is the error. I am looking forward to figuring this out as i have about 20 sites i'd like to change to search this way...thanks for helping me out: Server error: Unable to retrieve schema information from the query: Search=Replace(Request("Search")," ","%") SELECT * FROM products WHERE (itemname LIKE '%"&Search&"%') ORDER BY 1 against a database using the connection string DRIVER={Microsoft Access Driver (*.mdb)};DBQ=URL=fpdb/louisvilleguide.mdb. The following error message comes from the database driver software; it may appear in a different language depending on how the driver is configured. ------------------------------------------------------- [Microsoft][ODBC Microsoft Access Driver] Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'. Source: Microsoft OLE DB Provider for ODBC Drivers Number: -2147217900 (0x80040e14)
|
|
|
|
jonance
Posts: 298 From: Louisville KY USA Status: offline
|
RE: Search without requiring exact phrase - 9/28/2003 18:36:17
I didn't put it on the diet yet. I just tried to use the drw and do the custom sql query...that is where it rejected it. I know how to put it on the diet and will do so, can you just explain where to put that code? I see where the second linne would go (after fp_sQry i assume)..but how about that first line? Here is my UNEDITED code after the diet....thanks again for your help. John quote:
<% fp_sQry="SELECT * FROM products WHERE (itemname LIKE '%::search::%') ORDER BY ::SortColumn::" fp_sDefault="SortColumn=brands" fp_sNoRecords="<tr><td colspan=12 align=left width=""100%"">No products matched your search criteria...</td></tr>" fp_sDataConn="louisvilleguide" fp_iMaxRecords=0 fp_iCommandType=1 fp_iPageSize=20 fp_fTableFormat=True fp_fMenuFormat=False fp_sMenuChoice="itemname" fp_sMenuValue="itemname" fp_iDisplayCols=12 fp_fCustomQuery=True BOTID=0 fp_iRegion=BOTID %>
|
|
|
|
jonance
Posts: 298 From: Louisville KY USA Status: offline
|
RE: Search without requiring exact phrase - 10/6/2003 11:07:08
Thanks spooky..it works except for one thing. The 'next', 'prev', etc. buttons do not work properly with that code. For example: Go to http://www.axiomskatesales.com/searchtest2.asp Do a search for 'black'. Then scroll down and click 'next'...see the error on the next page, and it returns no results. Is there any way to get that to work with this code? Thanks, John
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|