On Friday 12 April 2002 8:10 pm, Carl Schmidt wrote:
> I have a form where a user enters some numbers into text boxes.  Some of
> the text boxes can be left blank.  The business logic receives all
> variables to all text boxes.  Should I :

I'm assuming that you are using an executable file and NOT a web form.  Any 
data you get from a web form, you must treat as suspect and perform business 
logic checks in another tier.

> 1.) Validate on the page for the presence of a value, and if not, set the
> corresponding value to -1 (it will never be this value).  Therefore the
> business logic blindly inserts everything.

This is reasonable.  Alternatively, set the corresponding value to NULL.

> 2.)  Do not have the variables that correspond to blank text boxes be
> set to -1.  Have the business logic build a query based on which variables
> are or
> are not containing a value.  In this case some fields for that row may be
> null.

I'd avoid this if you can.  Too much dynamicness and it will be hard to test.

sql,query.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to