Re: [PHP-DB] Advice On Building Dynamic MySQL Queries

2001-04-20 Thread JD Daniels
Thanks for the replies :) Victor's suggestion put me on the right track. (I still have trouble with language constructs) Heres what I have now.. All I need to do is name my form fields with the same name as the column names from the mysql table, and presto! now I can just add/remove from the sear

RE: [PHP-DB] Advice On Building Dynamic MySQL Queries

2001-04-20 Thread Jonathan Hilgeman
1800 AND ID=43"; Worked well for me. Jonathan Hilgeman -Original Message- From: JD Daniels [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 10:41 AM To: [EMAIL PROTECTED] Subject: [PHP-DB] Advice On Building Dynamic MySQL Queries I am building a query from a sear

Re: [PHP-DB] Advice On Building Dynamic MySQL Queries

2001-04-19 Thread Joe Brown
My solution was almost as elegent... $query="select * from customers"; $queryand=false; if(!empty($f_Account)) { $query.=" WHERE upper(P.Account) like upper('$f_Account')"; $queryand=true; } if(!empty($f_First_Name)) { $query.=($queryand?" AND ":" WHERE ")."upper(p.First_Nam

Re: [PHP-DB] Advice On Building Dynamic MySQL Queries

2001-04-19 Thread Victor Foitzik
Hello JD, on 19.04.2001 you wrote: > if (!empty($Price)) > { > if(empty($whereclause)) > { > $whereclause.="Price$Price"; > } > els

Re: [PHP-DB] Advice On Building Dynamic MySQL Queries

2001-04-19 Thread Victor Foitzik
Hello JD, on 19.04.2001 you wrote: > I am building a query from a search form. This is the code I have now: > if (!empty($whereclause)) > { > $whereclause=urldecode($whereclause); > $whereclause=stripslashes($whereclause); > } > extrac

[PHP-DB] Advice On Building Dynamic MySQL Queries

2001-04-19 Thread JD Daniels
I am building a query from a search form. This is the code I have now: if (!empty($whereclause)) { $whereclause=urldecode($whereclause); $whereclause=stripslashes($whereclause); } extract($HTTP_POST_VARS); if (!empty($