Skip to main content
Inspiring
December 12, 2011
Question

search engine

  • December 12, 2011
  • 4 replies
  • 800 views

Dear all,

I have below parameter for search engine, it search only in Name, I have to make it also to search in WebLink?! How to do that?!

SELECT *

FROM WebSite

WHERE Name = MMColParam1

ORDER BY NameID DESC

Please your help ASAP.

Thanks and regards,

FAIZ ALI

This topic has been closed for replies.

4 replies

faiz2000Author
Inspiring
December 17, 2011

Thank you for your help

bregent,illbehere

Participant
December 14, 2011

Just so you know, it would be a good idea to give your MMColParam variables a meaningful name rather than the default Dreamweaver name, it will help you keep track of which variables you're accessing in you queries. Bregent is correct, you wanted to search the same variable by two different fields originally, so an OR would give you that result. If you wanted to match values exactly you would use:

SELECT *

FROM WebName

WHERE WebName = meaningfulVariableName AND WebLink = anotherMeaningfulVariableName

ORDER BY WebName DESC

Your current solution will give you results that include characters before and after your query string, so if variable1 = "website" it would also return "mywebsite", "websiteforyou", etc.

I hope this helps, the only reason I am blathering like this is that I have much less hair from trying to figure all this stuff out and I thought I'd save you some of yours :-).

Tom

faiz2000Author
Inspiring
December 14, 2011

This is Solution

SELECT *

FROM WebName

WHERE (WebName LIKE %MMColParam1%  OR WebLink LIKE %MMColParam2% ) and UserID = MMColParam

ORDER BY WebName DESC

Participating Frequently
December 14, 2011

Yes. That's a completely different query than what you originally asked for thought. Right? Your original query did not use the LIKE predicate or contain the UserID.

Participating Frequently
December 13, 2011

SELECT *

FROM WebSite

WHERE Name = MMColParam1 OR

WebLink = MMColParam1

ORDER BY NameID DESC

faiz2000Author
Inspiring
December 14, 2011

NO,It didn't work?!

Syntax error in query expression 'WebName LIKE ? OR WebLink LIKE %MMColParam1% and UserID = ?'.