Home    Cart    Free Download    Manual

Installation:
  Free Downloads
  The H2O Family
  Install Notes

Programming:
  Prerequisites
  H2O Whitepaper
  Online Manual
  Code Examples
  H2O Free Support


What's H2O?
H2O is programming made for the web.

What's it like?
H2O is English-like. If you know some Perl, VB, ASP, or PhP you'll be immediately productive in H2O. It runs on Linux, Mac, Unix, and Windows.

How do I try it?
Download H2O for free. Get it from hosting providers. Or buy on-line.

Where does H2O come from?
The language was invented by Aestiva. H2O stands for:
   HTML with
   HTML/OS
   Overlays.


Database Search and Results

The code below shows how to build a simple search page with results.

The top of the page is an HTML form linked to an onclick Overlay called doit. When the search is submitted, doit is run. The top of doit has some settings. You will want to set dbname, fieldlist, and searchfield to match the database you set up. To set up a database use DBConsole, an application included with the latest versions of H2O.

After the variables are set in doit, the macro does the search using DBFIND. Note how the query string is built. The query string uses a "Boolean" format. Suppose you want to search the field clothing for the text jeans, for example. The query would be:

      clothing ~ "jeans"

The ~ character means "begins with." When building the query, you need to build the query string in this Boolean format. You write:

      db_query = searchfield + ' ~ "' + db_mysearch + '"'

where searchfield is a variable containing the name of the field you wish to search, and db_mysearch is the variable that holds the text enterd into the HTML search form submitted by your user. For more advanced queries you write more advanced forms of this Boolean query string.

The DBFIND tag places its result in db_results and then the page is redisplayed. When the page is redisplayed the IF-THEN statement in the page is activated and the resultsd are displayed. Note the use of the function:

      DISPLAY NAME=array "result_format" /DISPLAY

This is a quick way to take an array and display it across a page. For greater control you will want to use a FOR loop.


dbfind.html



<html>
<title>Sample Search</title>

<b>Enter First Name:</b>
<form method=post action=doit>
<input type=text size=15 name=db1_mysearch>
<input type=submit value="Search">
</form>
<ul>
<table border=0>

<< IF db_results="ERROR" THEN db_results="" /IF
IF db1_results[1,1] != "" THEN
DISPLAY "<ul type=square>" /DISPLAY
DISPLAY NAME=db_results
"<tr><td>[1]</td><td>[2]</td><td>[3]</td></tr>"
/DISPLAY
ELSE
DISPLAY
"<tr><td align=center>No results to display.</td></tr>"
/DISPLAY
/IF

>>

</table>
</html>
<<overlay doit
# set dbname, search field name, and field list below /#
dbname="/dbname"
fieldlist="data_name,data_city,data_state,data_zip"
searchfield="somefiledname"

# the search is done here /#
db_mysearch=CUTALL(db_mysearch,'"')
db_query = searchfield + ' ~ "' + db_mysearch + '"'
db_results=DBFIND(dbname,db_query,1,30,fieldlist)
GOTO PAGE
>>


Home | Cart | Free Download | Online Manual
COPYRIGHT © 2005 Aestiva, LLC. ALL RIGHTS RESERVED.