I am running a query for a MySQL database to pull in the values of the field user_email.
How would the syntax of a query look to remove the portion of the e-mail addresses after the @ symbol?
e.g I want johndoe@aol.com to read either johndoe@ or johndoe@** so it will be obvious that it was intentionally truncated.
Thanks.
You can just explode johndoe@aol.com
$email = explode("@", $user_email);
You now have two parts in an array:
$email[0] will be johndoe, $email[1] will be aol.com.
Finally, add @ to $email[0].
$email = $email[0] . "@";
Richie. geocities.com/akindele/
Thanks Richie...very helpful indeed.
Is there a MySQL query command that would do similarly?
e.g.
johndoe@aol.com janddoe@msn.com . . . benlazy@ups.com
Select user_email as email_short FROM dbase yada yada yada
okay...i found the answer:
SELECT SUBSTRING_INDEX(user_email, '@', 1) as email_short