This package has various functions for generating html code from an SQL table structure and for generating SQL statements (Select, Insert, Update, Delete) from an html form. You can easily build a complete forms interface to an SQL database (query, add, update, delete) without any programming! The software is available at http://www.odbsoft.com/cook/sources.htm
All functions are very simply called by submitting a link with the tablename in the submission parameters. The 'table' parameter is required on all forms, the 'id' parameter is required on update and delete, all other parameters are optional.
Produces a query form and submit button. The fields optional parameter is the fields to include on the form; the default is to include all non TEXT (i.e. long) columns. The orderby parameter orders the result set. The debug parameter displays the generated SQL statement(s).
Produces a full-record printout with all columns.
Produces a data-entry form and submit button.
Produces a filled in data-entry form and allows user to modify record after verifying security key.
Deletes the record after verifying the security key.
On Unix mysql tablenames are case sensitive, but not column names. Create your tables and columns with capitalization to maximize readability, since these are the names that will be displayed on the forms.
Rename your html file with a .shtml extension and add the following command:
<!--#exec cmd="perl query2.pl table=Resources fields=ID,Resource_Type " -->
Give your file execute access and put it in your cgi-bin directory.
To edit the source code, use an editor that preserves tabs (for instance. Microsoft Developer Studio).
For security reasons SQL error information is not returned to the web user. Test your application from the command line by creating a data file with the names/values of submission parameters on each line ("field=value") and then issuing the command: perl query.pl <t.dat; or else enter parameters when prompted and end with ctrl-Z (ctrl-D on Unix). Remember to tell genquery.pl whether you are using a local (ODBC) data-source or a remote one, see dbOpen() function.
Consult List of known bugs.
Send feedback, appreciation, enhancements, and business propositions to marc@odbsoft.com
This software is freely modifiable and distributable, but please keep the author/contact information on the source header.