I am trying to build a sql statement based on form input. I want the where clause to reflect only those values that have been filled in.
So:
$id='1';
$category='Oracle Server';
$sqlstatements = array(1=>$id, 2=>$category);
ksort($sqlstatements);
while (list($value,$Elements) = each($sqlstatements)){
[I]This is where I would like to build the sql statement listed below[/I]
}
select a., b.
from books a, authors b
where a.author1=$id
and category=$category;
I am having problems getting the where / and sequence right. Is this how others build these sql statements?