On Wednesday 10 November 2004 15:37, Stuart Felenstein wrote:
> --- Jason Wong <[EMAIL PROTECTED]> wrote:
> > Why not build your sql query according to whether or
> > not whatever you want is
> > selected or not.  That way debugging is easier as
> > you won't be looking at
> > queries that contain redundant "... AND 0 ...".
>
> Jason, How would I do that ? Care to share a short
> exmaple ?

A simplistic pseudo-code version:

  $sql = "SELECT <blah> WHERE 1"; 
  if ($something = "selected") {
    $sql .= "AND something";
  }
  ...
  ...
  $sql .= "... rest of query";

Anyway, someone has already posted a more detailed example.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
Hmm...  Which would do a better job at driving physicists crazy?  Travel
faster than light, or a floating-point boolean value?
        -- Michael Mol
*/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to