DUH! sorry, looking at query only and ignoring code! By your logic you always fall into the final ELSE if two or more form fields are set, which isn't what you want. Have a look at http://www.mredding.co.uk/pw.html Test each form variable in turn. If it's not null, add to the set_clauses variable. Note the handling in relationship and privacy -- determining if comma needed - I've left that out of the remaining three for clarity so don't forget to add it. Finally, build the full query from the components and execute. If it fails, do something, else do your header call. Note the exit() -- always put one of these in after header Location -- else code lwoer down may execute which isn't usually what you want.
Last edited by PaulW; 12-12-2010 at 11:35 AM..
|