|
DBSearch enables simple and advanced searches of any database located in the _root directory on your website. You specify the name and 'relative' location of the database as well as the table, index, and field(s) to be searched from your web page, and the dbsearch function does the rest. You specify exactly how your search return is set up on your template page by defining a section of HTML to be repeated for each record returned.
To set up a dbsearch on a web page, you must have all of the following fields defined within the <FORM></FORM> tags in your HTML page and make sure that the values are correct and correspond to the fieldnames in your database.
REQUIRED FORM INPUT VALUES
| INPUT |
POST METHOD |
GET METHOD |
| Opening Tag |
<FORM METHOD="POST" ACTION="/cgi-bin/dbsearch.exe"> |
/cgi-bin/dbsearch.exe |
| mdb |
<input type="hidden" name="mdb" value="\mydatabase.mdb"> |
mdb=\mydatabase.mdb |
| tbl |
<input type="hidden" name="tbl" value="MyTableName"> |
tbl=MyTableName |
| dbindex(s) |
<input type="hidden" name="dbindex" value="IndexName, IndexName2, IndexName3"> |
dbindex=TheIndexName |
| template |
<input type="hidden" name="template" value="\return.asp"> |
template=\return.asp |
| nextpage |
<input type="hidden" name="nextpage" value="/noresult.asp"> |
nextpage=/noresult.asp |
| error template |
<input type="hidden" name="errortemplate" value="\error.asp"> |
errortemplate=\error.asp |
mdb
The name and path of the database referenced with this command. If you wish to use a type of database other than MS Access use dbtype described below.
tbl
The Table or SQL Query to be used/searched in this database function. For more information on using SQL see: Using SQL.
dbindex(s)
Specifies the index field that the data will be sorted by. The index field will specify the order of the returned records and sort the data in the database table by that field. More than one Index can be specified with commas, as shown above.
template
This will give the location path and file name of the results/return page. See below for a detailed description.
nextpage
This is the path and filename of the page that is shown when there are no records found matching the search. This page will be shown instead of the results/return page.
error template
This page is used instead of the 'nextpage' parameter when there is no data matching the search criteria. The Error Template adds the ability to pass the search data to the template page for re-display.
ADVANCED FUNCTIONS
| INPUT |
POST METHOD |
GET METHOD |
| db type |
<input type="hidden" name="dbtype" value="See Chart"> |
dbtype=See Chart |
| reverse |
<input type="hidden" name="reverse" value="yes"> |
reverse=yes |
| Specify Field |
<input type="text" name="DB_Fieldname"> |
DB_Fieldname=value |
| multiple fields |
<input type="text" name="DBX_Fieldname"> |
DBX_Fieldname=value |
| Return All |
<input type="hidden" name="DB_RETURN_ALL" value="Fieldname"> |
DB_RETURN_ALL=fieldname |
| User IP |
<input type="hidden" name="DB_USER_IP_(fieldname)" value="yes"> |
DB_USER_IP_Fieldname =yes |
| DBCOMP |
<input type="hidden" name="DBCOMP" value="ABS"> |
DBCOMP=ABS |
| dblessthan |
<input type="hidden" name="DBLESSTHAN" Value="10"> |
DBLESSTHAN=10 |
| dbgreater |
<input type="hidden" name="DBGREATER" Value="1"> |
DBGREATER=1 |
| RETURNMAX |
<input type="hidden" name="ReturnMax" value="25"> |
ReturnMax=25 |
| SearchNext |
<input type="hidden" name="SearchNext" value="##SearchNextValue##"> |
N/A |
| SearchPrev |
<input type="hidden" name="SearchPrev" value="##SearchPrevValue##"> |
N/A |
| SearchData |
<input type="hidden" name="DB_FIELDNAME" value="##SearchData##"> |
N/A |
| SAVEAS |
<input type="hidden" name="SAVEAS" value="/path/filename.asp"> |
SAVEAS=/path/filename.asp |
| DBEMAIL |
<input type="hidden" name="DBEMAIL" value="URL"> |
N/A |
| WHOFROM |
<input type="hidden" name="WHOFROM" value="you@yoursite.com"> |
N/A |
| WHOTO |
<input type="hidden" name="WHOTO" value="yourcustomer@theirsite.com"> |
N/A |
| SUBJECT |
<input type="hidden" name="SUBJECT" value="Thank You for Registering"> |
N/A |
| EveryXthValue |
<input type="hidden" name="EveryXthValue" value="4"> |
N/A |
db type
The "dbtype" input value needs to be used when using a legacy database other than an Access database. To determine the value for this field refer to the legacy database chart.
reverse
A qualifying function of dbindex. Reverses the order of the return so you can have the return results sorted by latest to earliest date, or newest order number to oldest etc. Reverses the return results of ANY fieldname in your database.
Specify Field
Used instead of dbindex. Use the FieldName of the field that you wish to search on and place DB_ in front of it.
multiple fields
Narrows down a search return. For the first field in the search use the FieldName of the field that you wish to search and place DB_ in front of it as above. For each additional field use a DBX_ in front of each FieldName.
Return All
DB_RETURN_ALL makes sure that all records within a field in the database are returned. This can be used with SearchNext and SearchPrev functions as well.
User IP
DB_USER_IP_ Obtains the IP Address of the person submitting the DBSearch and searches the specified field for match(s).
DBCOMP
Makes the search return an exact match. Example if you searched on a field with the DBCOMP tag for "sm" you would be returned a record that had the exact value of "sm" and would not be returned a record that was a partial match like "smith".
dblessthan
Only the numeric values less than or equal to this tag will be returned.
dbgreater
Only the numeric values greater than or equal to this tag will be returned.
RETURNMAX
Specifies the number of returns displayed (up to 50) on your template page.
SearchNext
A 'Forward' or 'Next X' button. Allows you to continue searching for the next records. You would put this code on your template page, the page returned after your initial search. You would also need to have an input for the original field searched with the ##SearchData## tag as the value. You can also use the ReturnMax variable to set or change the amount of records returned.
SearchPrev
A 'Back' or 'Previous X' button. Allows you to search the previous records. You would put this code on your template page, the page returned after your initial search. You would also need to have an input for the original field searched with the ##SearchData## tag as the value. You can also use the ReturnMax variable to set or change the amount of records returned.
SearchData
The SearchData Tag is used to 'carry on' or retain the original search data from the initial search page through each consecutive return page. It reused each time the search is advanced through the records returned.
Single Field Search: Use DB_(fieldname) on the search page instead of dbindex. The tag to retain the original search variables through each consecutive search of the database is
<input type="hidden" name="DB_FIELDNAME" value="##SearchData##">
as shown in the table above.
Multi Field Search: For Multi-Field Searches you use the above ##SearchData## to return the value for the first DB_(fieldname). To return the values for the ensuing DBX_(fieldnames), you need to use the ##SearchDataX## tag:
<input type="hidden" name="DBX_LastName" value="##SearchData1##">
<input type="hidden" name="DBX_MiddleName" value="##SearchData2##">
<input type="hidden" name="DBX_PhoneNumber" value="##SearchData3##">
SAVEAS
SAVEAS allows you to store the result of your search to a text file with a name of your choice. File extensions can be any type of text file like .css, .aspl, .asp, .txt, .js, etc. You can generate a unique (exact date/time based) file name by placing ####. prior to the file extension, ####.asp for example. SAVEAS can also generate an actual portion of the filename. First, assign whatever name you would like to the file, then place ####. exactly prior to the file extension you wish to specify:
open_orders_####.txt for example.
DBEMAIL
The template is emailed to your user, and they are sent to the URL set by DBEMAIL. An example message might be:
Thank you for registering with Our Company, John Doe. Please go to:
http://www.yoursite.com/comegetyourfreebies.asp
WHOFROM
Sets the source email address in DBEMAIL.
WHOTO
Sets the destination email address in DBEMAIL.
SUBJECT
Sets the subject of the email message in DBEMAIL.
EveryXthValue
Inserts HTML commands into a repetitive sequence when building the output using the template. This is useful for applications that need to terminate table rows and start new rows of data output. For example, if you use '4' as the value, the data would be displayed like this:
This is useful for setting up rows of clickable thumbnail images.
©1995-2001 InfoDial, Inc.
|