phpSQLGen provides functions for generating SQL queries, HTML tables, and XML documents. It consists of two classes and a set of utility functions. SQLGen provides PHP functions for generating SQL query strings from arrays, and TableMaker generates an HTML table or XML document from an ADOdb result set or an array. Since the output of each SQLGen method is a SQL query string, the library is compatible with ADOdb, PEAR DB, PHPLib, and any other database abstraction layer that can execute SQL query strings. This is useful for constructing complicated SQL queries that vary according to the situation. Different if-then clauses can push items onto from the argument array - SQLGen will take care of inserting commas and "ands" into the query string as necessary. This can be used together with the ability to populate an array directly from a form for the automatic generation of SQL queries from form variables.