#!/usr/bin/scriba -c
INCLUDE cgi.bas
INCLUDE odbc.bas
cgi::Header 200,"text/html"
cgi::FinishHeader
PRINT """
<HTML>
<HEAD>
<title>unixODBC testing</title>
</HEAD>
<BODY>
<FONT face="Verdana, Arial, Helvetica, sans-serif">
<TABLE border="1" cellpadding="3">
"""
ON ERROR GOTO PROBLEMS
dbh = ODBC::RealConnect("DSN","user","password")
ODBC::query(dbh,"SELECT * FROM contact")
PRINT "File Handle: <b>",dbh,"</b><br>"
PRINT "Affected Rows: <b>",ODBC::AffectedRows(dbh),"</b><br>"
WHILE ODBC::FetchHash(dbh,column)
PRINT "<TR>"
PRINT "<TD>",column{"ID"},"</TD>"
PRINT "<TD>",column{"NAME"},"</TD>"
PRINT "<TD>",column{"ADDRESS"},"</TD>"
PRINT "<TD>",column{"CITY"},"</TD>"
PRINT "<TD>",column{"STATE"},"</TD>"
PRINT "<TD>",column{"ZIP"},"</TD>"
PRINT "<TD>",column{"PHONE"},"</TD>"
PRINT "<TD>",column{"EMAIL"},"</TD>"
PRINT "<TD>",column{"URL"},"</TD>"
PRINT "</TR>"
WEND
PRINT """
</TABLE>
</FONT>
</BODY>
</HTML>
"""
ODBC::Close(dbh)
END
PROBLEMS:
PRINT "ERROR = ",error(),"<br>"
RESUME