Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with query

Guest
Dec 14, 2008 Dec 14, 2008
I have the following record in my database:

Field = Name
Value = a test

When i run the following query using a form variable that is "atest" I don't get any results, but if i use a form variable that is "a test" then it works fine. What can i do in order to get that record when i input the search term "atest".

<cfquery name="test" datasource="#DSN#">
SELECT *
FROM tbl_main
where Name LIKE '%#form.name#%'
</cfquery>
TOPICS
Database access
757
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 14, 2008 Dec 14, 2008
use you db's string manipulation functions to remove all whitespace from
the column's value?

but i would rather consider emplying some fulltext searcing, either
using your db's built-in functionality or using verity or similar tool,
if you need to return records that do not exactly match the entered
search term...

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 14, 2008 Dec 14, 2008
Thank you for your response, how do i enable verity on a database? I have been looking on google and can't find any information relating to that.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 16, 2008 Dec 16, 2008
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 18, 2008 Dec 18, 2008
LATEST
Thank you for your response, after reading a bunch of stuff on verity and full text searching, i think full text searching is what i need. But now i can't figure out what i am doing wrong with this query, it doesn't get any results.

I have the following table with

tbl_company
===============================
cid(int) | 1 | 2 | 3 |
name(text) | a test | another test | delta company |
url(varchar) | www.atest.com | www.anothertest.com | www.deltacompany.com |

SELECT *
FROM tbl_company
WHERE MATCH (name) AGAINST ('a')

I am using mysql 5 on debian linux and have enabled fulltext on the name field

Can someone please help me with this? Any help is very much appreciated.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources