View Single Post
Old 02-16-2007, 06:36 AM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

the thing to remember here is that ajax allows for database calls without a page refresh. So this question has nothing to do with ajax.

your question relates to search complexity

what i have done before is catch the form values as normal but build up the SQL dynamicaly so lets take this example...

PHP Code:
$id $_POST['id'];
$id2 $_POST['id2'];
 
select from table where id '$id' and id2 '$id2' 
and change it to this...

PHP Code:
$id $_POST['id'];
$id2 $_POST['id2'];
 
if(
$id){$SQL "id ='".$id."'";}
 
if(
$id2){$SQL .= "and id2 ='".$id2."'";}
 
select from table where '$SQL' 
This means your WHERE clause is created dynamicaly
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote