473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Need help with email-match query


I'm trying to figure out a MySQL query expression to match an email
address. Here's the situation:

User registers on my site with a "plus style" email address
(us**********@example.com). This is a perfectly legal address and I
don't want to disallow it, because I use this style myself and find
it useful. For example us***********@gmail.com will get delivered
to us**@gmail.com.

Now, the user forgets his password. He is prompted to enter his
email address, to which my site will send a temporary password.

Problem: if he enters us******@example.com instead of the address
us**********@example.com that's stored in my database, I should be
able to find the address. How do I construct a MySQL query to match
what the user enters with the "plus" address in the database?

The simplest way is to strip the +suffix from the username when the user
first registers on my site, but I'd rather not do that.

-A
Sep 11 '07 #1
9 1597
axlq wrote:
I'm trying to figure out a MySQL query expression to match an email
address. Here's the situation:

User registers on my site with a "plus style" email address
(us**********@example.com). This is a perfectly legal address and I
don't want to disallow it, because I use this style myself and find
it useful. For example us***********@gmail.com will get delivered
to us**@gmail.com.

Now, the user forgets his password. He is prompted to enter his
email address, to which my site will send a temporary password.

Problem: if he enters us******@example.com instead of the address
us**********@example.com that's stored in my database, I should be
able to find the address. How do I construct a MySQL query to match
what the user enters with the "plus" address in the database?

The simplest way is to strip the +suffix from the username when the user
first registers on my site, but I'd rather not do that.

-A
MySQL questions should be asked in comp.databases.mysql. This is a PHP
newsgroup.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 11 '07 #2
On 11.09.2007 04:10 axlq wrote:
I'm trying to figure out a MySQL query expression to match an email
address. Here's the situation:

User registers on my site with a "plus style" email address
(us**********@example.com). This is a perfectly legal address and I
don't want to disallow it, because I use this style myself and find
it useful. For example us***********@gmail.com will get delivered
to us**@gmail.com.

Now, the user forgets his password. He is prompted to enter his
email address, to which my site will send a temporary password.

Problem: if he enters us******@example.com instead of the address
us**********@example.com that's stored in my database, I should be
able to find the address. How do I construct a MySQL query to match
what the user enters with the "plus" address in the database?

The simplest way is to strip the +suffix from the username when the user
first registers on my site, but I'd rather not do that.

-A
hi

you can use mysql regular expressions, e.g.

select * from users where email rlike 'user([+][^@]+)?@example[.]com'

or, if you need this query often create an extra "canonical email"
column in the database.

--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Sep 11 '07 #3
In article <K5******************************@comcast.com>,
Jerry Stuckle <js*******@attglobal.netwrote:
>
MySQL questions should be asked in comp.databases.mysql. This is a PHP
newsgroup.
....which is about a language that integrates with mySQL. Not
everyone (including me) gets comp.databases.mysql. I didn't even
know that group existed until just now.

If you didn't want to answer the question, why did you bother replying?

-A
Sep 11 '07 #4
In article <46***********************@read.cnntp.org>,
gosha bine <st********@gmail.comwrote:
>
you can use mysql regular expressions, e.g.

select * from users where email rlike 'user([+][^@]+)?@example[.]com'
Cool. That's just what I wanted to know. I feared the answer would
involve something inefficient like reading in the entire column and
processing it in php.
>or, if you need this query often create an extra "canonical email"
column in the database.
I was thinking of that solution too, but adding a redundant column,
didn't seem as elegant as constructing a query to work with what I
have.

-A
Sep 11 '07 #5
..oO(axlq)
>Jerry Stuckle <js*******@attglobal.netwrote:
>>
MySQL questions should be asked in comp.databases.mysql. This is a PHP
newsgroup.

...which is about a language that integrates with mySQL. Not
everyone (including me) gets comp.databases.mysql. I didn't even
know that group existed until just now.
If that group is not available on your newsserver you should ask the
server admin for adding it. If they don't want that, you should find a
better newsserver.

Micha
Sep 11 '07 #6
In article <ms********************************@4ax.com>,
Michael Fesser <ne*****@gmx.dewrote:
>If that group is not available on your newsserver you should ask
the server admin for adding it. If they don't want that, you should
find a better newsserver.
My newsserver is a part of my hosting service. My admin will add
new newsgroups any customers ask for. I just didn't know it existed
in the first place.

-A
Sep 12 '07 #7
axlq wrote:
In article <K5******************************@comcast.com>,
Jerry Stuckle <js*******@attglobal.netwrote:
>MySQL questions should be asked in comp.databases.mysql. This is a PHP
newsgroup.

...which is about a language that integrates with mySQL. Not
everyone (including me) gets comp.databases.mysql. I didn't even
know that group existed until just now.

If you didn't want to answer the question, why did you bother replying?

-A
Because this is a PHP group, not a MySQL group. PHP interfaces with
Apache and Linux, also. So from your argument Apache and Linux
questions should be asked in this group, also.

That's why there are multiple groups. And if your news server doesn't
have comp.databases.mysql, ask them to get it. Or use Google Groups.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Sep 12 '07 #8

"Jerry Stuckle" <js*******@attglobal.netwrote in message
news:AK******************************@comcast.com. ..
axlq wrote:
>In article <K5******************************@comcast.com>,
Jerry Stuckle <js*******@attglobal.netwrote:
>>MySQL questions should be asked in comp.databases.mysql. This is a PHP
newsgroup.

...which is about a language that integrates with mySQL. Not
everyone (including me) gets comp.databases.mysql. I didn't even
know that group existed until just now.

If you didn't want to answer the question, why did you bother replying?

-A

Because this is a PHP group, not a MySQL group. PHP interfaces with
Apache and Linux, also. So from your argument Apache and Linux questions
should be asked in this group, also.

That's why there are multiple groups. And if your news server doesn't
have comp.databases.mysql, ask them to get it. Or use Google Groups.
amen. however, we should do him a favor and explain why he's going to be
laughed at in any db ng. the term is "magic values". i had to wait this long
to respond because i was rolling forever when i saw the user+key@domain
construct!

cheers.
Sep 12 '07 #9

"axlq" <ax**@spamcop.netwrote in message
news:fc**********@blue.rahul.net...
In article <46***********************@read.cnntp.org>,
gosha bine <st********@gmail.comwrote:
>>
you can use mysql regular expressions, e.g.

select * from users where email rlike 'user([+][^@]+)?@example[.]com'

Cool. That's just what I wanted to know. I feared the answer would
involve something inefficient like reading in the entire column and
processing it in php.
>>or, if you need this query often create an extra "canonical email"
column in the database.

I was thinking of that solution too, but adding a redundant column,
didn't seem as elegant as constructing a query to work with what I
have.
i think what he's suggesting is not a redundant column. rather, a normalized
structure. one where an "email address" column contained only email
addresses (minus any other magic data you are combining with it). your "key"
in user+key@domain should be in its own column and given a well fitted name
that describes briefly what "key" is.
Sep 12 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: James Hong | last post by:
Help please, I try to sending an email from my html page using the java applet. but it give error on most of the PC only very few work, what is the error i make the java applet show as below ...
4
by: nephish | last post by:
hey there, i have a script that retrieves my email, but i need it to be able to strip all the stuff off except the body (the message itself) so i can later write it to a text file. anyone know...
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
4
by: krishnakant Mane | last post by:
hello, I am a bit confused. I want to make a program that will take some data from a database and make a string of text. and send it to the respective email id of a person. next I also want to...
4
by: shror | last post by:
dear all, i have started learning php 2 weeks ago and i have wrote my first script for mail sender and the script takes all my data and move to the thanks page but the problem is that the mails...
1
by: jerger | last post by:
I have not made a program or page from start yet. I have made modifications to our signoff asp pages like changing the questions, texts, shortening field lengths etc... I also have copied the files...
1
by: saravanatmm | last post by:
I need javascript code for validate the email address. Email address field cannot allowed the capital letters, special characters except '@' symbol. But can allowed the small letters, numeric...
6
by: mohaaron | last post by:
Hello all, I'm not very good with writing regular expressions and need some help with this one. I need to validate an email address which has the full name of the person appended to the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.