walter
|
Posted: 12/15/2003, 11:30 AM |
|
I have created a mysql database with a full text index and am trying to create a search page and results page. In my search page, I have created a field to pass to the results page called string.
In the results page, I have created the following SQL statement to query the the database:
SELECT * FROM docs WHERE MATCH (title,description) AGAINST ('string')
My problem is that it is not pulling up the results. It is only pulling up the results that match "string". I am not sure what to use. I have tried the following:
1. SELECT * FROM docs WHERE MATCH (title,description) AGAINST (' "string" ') - returns error
2. SELECT * FROM docs WHERE MATCH (title,description) AGAINST ('fldstring') - returns no results
3. SELECT * FROM docs WHERE MATCH (title,description) AGAINST ('(fldstring)') - resturns no results
4. SELECT * FROM docs WHERE MATCH (title,description) AGAINST ('{string}') - returns no results
I am unsure how to put my variable field in my SQL statement. Any help would be appreciated.
|
|
|
walter
|
Posted: 12/15/2003, 11:46 AM |
|
I am using asp.
|
|
|
Ken Hardwick -CC/ASP
|
Posted: 12/15/2003, 4:01 PM |
|
With fldString as your variable,
SELECT *
FROM docs
WHERE MATCH (title,description) AGAINST ('" & string & "')
I use this feature all the time.
FYI, for situations like this, generate your ASP page, then review
the generated page in order to determine how to implement little
trick like this.
Same logic can be used for default values.
In the default text box..your can enter something like,
" & defaultValue & "
Ken Hardwick
Norman, Ok
|
|
|
Ken Hardwick -CC/ASP
|
Posted: 12/16/2003, 4:26 AM |
|
WHERE MATCH (title,description) AGAINST ('" & string & "')
should be
WHERE MATCH (title,description) AGAINST ('" & fldstring & "')
ie...
With fldString as your variable,
SELECT *
FROM docs
WHERE MATCH (title,description) AGAINST ('" & fldstring & "')
|
|
|
waltersowa
|
Posted: 12/24/2003, 7:35 PM |
|
Thank you for your help
|
|
|
|