The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
I have a query that searchs a specifc column in a table for data and if a match is found, results are presented on entries matching that specific search, however if no search is entered all entries in the database are displayed.
My question is, how would I go about checking the column being searched in the database and if the search text entered is not in the column, it throws out an error stating the item being searched on does not exist in the database? I know this is probably simple, though I've tried most of what I can and still nothing seems to be working for me right now ![]() As an example of what I mean, just in case I have confused anyone: The table name is resources and the column name is keywords (this is the column being searched on). The only entry in the database is vBulletin and the keyword column contains 'vbulletin, forum'. I would like to have a query where if a user searchs on 'community' then an error is shown since community is not a keyword that has been used in the database. I hope this makes sense. I've been working long hours so I am a bit tired and I know this is a bit jumbled - that's managment for ya! |
#2
|
||||
|
||||
![]()
You should have a form to submit the search keywords, yes ?
Upon submitting of that form, the search keywords would be taken to the script for processing. In the script, [sql] SELECT keywords from resources WHERE keywords LIKE '%$searchword%' [/sql] such a query would search for similar items in the db as your 'searchword', which is what you are trying to search. Then do a check if there are any result rows returned. If there aren't any results, ( like the e.g you described ), then present an error msg. |
#3
|
|||
|
|||
![]()
Here is what I am using to pull the data from the database right now:
Code:
$getresults = $DB_site->query("SELECT * FROM resources WHERE keywords LIKE '%$s%'"); while($results = $DB_site->fetch_array($getresults)) { eval('$searchresults .= "' . fetch_template('forum_searchbit') . '";'); } i.e. If vBulletin is my row entry and it has a keyword column entry of vbulletin, forum - when I search on community, the entry still shows when it should not. I need a way around that to prevent it from showing anything other than a "Please try another search term" when a word is not in the database ![]() I am hoping that is a bit more clear, just had a cup of coffee so I am a bit more awake than I was ![]() |
#4
|
|||
|
|||
![]() Quote:
![]() Appreciate the help and time ![]() |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|