Well, mysql has support for regex matching. The thing is
though, why store invalid email addresses in you database?
I think what you are doing is the right approach.
Check the email address validity first in php BEFORE saving
it to the database. At least you then know you are only
storing valid emails in your database.
If you store invalid emails in your database then how do you
get the user to correct the email address from mysql?
HTH
Keith
In theory, theory and practice are the same;
in practice they are not.
On Sat, 20 May 2006, Yesmin Patwary wrote:
> To: mysql@stripped
> From: Yesmin Patwary <yesmin25@stripped>
> Subject: Find invalid email formats using MySQL query.
>
> Dear All,
> My contact table has email field which contains many
> invalid email addresses. I find them using following php
> function. Is there a way to do that check in MySQL
> query?
>
> function emailValidate ($str)
> {
> $reg = "^([a-zA-Z0-9._-]+)@([a-zA-Z0-9-])+(\.[a-zA-Z0-9-]+)+$";
> if (eregi($reg, $str)) {
> return true;//-- good email
> }else{
> return false;//--bad email
> }
> }//--close function
>
> Thanks in advance for any comments or help.