SQL Abstraction Library 
An object-oriented class for PHP, from the Enzyme open-source project

http://Enzyme.sourceforge.net

This module is pretty simple, for a change. Just put the file SQL_Select.inc 
on your include path, and you're all set. For instructions on how to use it,
see the file comments. This code is released under the terms of the GPL. See
the LICENSE file for more information.

What does it do?
Provides a set of classes for creating and manipulating SQL statements. This
makes it easy to refer to your SQL statements by-name instead of by-value,
increasing portability.

It also means you do things like have a search form generate SQL (including 
arbitrary SQL joins) on the fly.

WARNING:

One thing that will confuse you is that there is a big terminology mistake
in the class names for SAL that is stuck there because of legacy reasons.
Basically, there are two classes for creating the FROM and WHERE statement
for a SQL SELECT statement. They are called

SQL_Cond
SQL_Join

Here's the catch: SQL_Join does not perform SQL joins! This is very important!
SQL_Join just joins two SQL_Cond objects using a conjunction like "and" or "or"
but that is all. If you want to create a SQL join, you have to use SQL_Cond.
I know that is counter-intuitive, sorry. 