So is there a function in mysql that I can call to validate dates?? Or do I need to build it?
Thanks, Anoop On 4/29/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > Anoop kumar V <[EMAIL PROTECTED]> wrote on 04/29/2005 11:00:11 AM: > > > Is it possible to do a date field validation using an sql query. > > > > Its like we have an html field- its a free form text field and the end > user > > should type in a valid date, of course in a predefined format only > > (MM/dd/yyy). I tried using javascript but either it works on some > browsers > > and not in others or the user can just disable javascript in eth > browser. > > > > SO I was hoping that I can use an sql query (some function in mysql) > which > > will return true or false based on whether the date is in the future, > valid > > (considering leap years etc..) and in the predefined format. > > > > Is this possible - is it a viable thing to do - all I want is a > foolproof > > way of validating the date input field. > > > > -- > > Thanks and best regards, > > Anoop > > What the user cannot disable and what you have full control over is the > page that receives the request from the user (the page that processes the > form the user submits). Use that page to validate your user's submission and > either kick the error(s) back to the user (possibly allowing them to > re-enter the information) or move on to generating the results (assuming > everything was OK). > > It's a wise idea to validate any user-provided information anyway before > sending it to the server. That way you have the ability to head off a SQL > server error (or SQL injection attack) before it ever happens. It not only > keeps your server more responsive (it doesn't have to spend the time tell > you it was bad data) but you have greater control over the entire process. > > Shawn Green > Database Administrator > Unimin Corporation - Spruce Pine > -- Thanks and best regards, Anoop