Construct, Q+E, QBE
| From: | Fernando Ortiz | Date: | Wed, 17 Jul 2002 13:51:15 +0000 |
| Subject: | Construct, Q+E, QBE | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-20603@lists.php.net to get a copy of this message | ||
I'm migrating my code from Informix 4GL to PHP, my problem now is how to
give the users the ability to make a query with the facilities that the
CONTRUCT verb gives in 4GL.
Suppose a form field name 'price' where the users can type the search
criteria
If the user type ... I need to get ...
123.23 "price = 123.23"
>100 "price > 100"
<=500 "price <= 500"
100..200 "price between 100 and 200"
100,200 "price in (100,200)"
In a string field named "city"
If the user type ... I need to get
sacramento "city = 'SACRAMENTO'"
sacra* "city MATCHES 'SACRA*'"
>Wy "city > 'WY"
etc.
Something like ..
$qbe = qbe('city','options')
$qry = "select * from customers where ".$qbe;
and the qbe function can get the typed from $_POST[$parm1] and using the
options chose between char or numeric data type , upshift or as is, matches
or like, etc.
Exist something like that?
I'm reinventing the wheel?
How are you solving this kind of problem?
TIA
--
Fernando Ortiz Muñoz
Fabrica de Jabon la Corona, SA de CV
MEXICO