-
April 12th, 2005, 04:43 PM
#1
Senior Member
Storing emails in MySQL
Hi Everyone!
Just got one question.
I'm trying to store e-mails in MySQL.
I know I can stor it as simple varchar, but I wanted to put some constraints on it.
Although I can't find any place, which give me some clear info on how to do it.
I though to do it like this
...
email varchar check(email in ('*@*.*'))
...;
Will it be correct or not? Is there a better way to do it?
P.S. For all those search Google adviser.
Please keep that advise for yourself. I ALREADY SEARCHED!
So unless you find something I didn't don't bother.
I'll go through the tutorial once again though. I might of missed something
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
-
April 13th, 2005, 05:52 AM
#2
-
April 13th, 2005, 07:57 AM
#3
this can be done in PHP before storing the addy -> http://www.sitepoint.com/article/use...il-address-php
v_Ln
-
April 13th, 2005, 02:40 PM
#4
Senior Member
Thanks guys. The info you gave me is very useful, but nevertheless not exactly what I need.
I'm just trying to put in some validation rules in place, so that the person who'll be looking after everything couldn't do to much harm, even if he want's to.
Couldn't trust him even a little bit with the work
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
-
April 13th, 2005, 06:37 PM
#5
Then you will need regular expressions in the scripting language you use to filter the input before it is stored the in the database.
http://www.zend.com/zend/spotlight/ev12apr.php
If you are using another lanuage, check the docs on how to use regular expressions, if it is supported.
-
April 14th, 2005, 03:31 PM
#6
Most people handle what you are trying to do in the business layer of their web application. The check you have down is about the best you can do for email address validation.
"When I get a little money I buy books; and if any is left I buy food and clothes." - Erasmus
"There is no programming language, no matter how structured, that will prevent programmers from writing bad programs." - L. Flon
"Mischief my ass, you are an unethical moron." - chsh
Blog of X
-
April 17th, 2005, 12:27 PM
#7
Hi
As it has been said, you should carefully check any input
in your database, before you actually start any communication
with it (eg. using SQL). The standard approach involves some
front end, which sends input data to a trusted application
(e.g. your server-side php script), which performs the
validation. Never ever trust client-side checks.
In addition
Scan your database regularily for entries which does not
follow your constraints. This should never happen by design,
but if, there are other data flows you are not controlling.
Search and eliminate.
Cheers.
If the only tool you have is a hammer, you tend to see every problem as a nail.
(Abraham Maslow, Psychologist, 1908-70)
-
April 22nd, 2005, 04:50 PM
#8
Senior Member
Unfortunately I'm only producing the database, and will have not control over it what so ever
Don\'t post if you\'ve got nothing constructive to say. Flooding is annoying
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|