I am trying to do a nested if, but it appears to break my query...
Here is a sample of what I am trying to, basically validating email
addresses out of a db:
select IF( (LENGTH( emailaddr ) <= 1 ||
NOT LOCATE( "\@",emailaddr ) ||
LOCATE( " ",emailaddr ),
(IF address.ts >= 20010813000000,
CONCAT( login, "\@blah.com ),
CONCAT( login, "\@crap.com )),
emailaddr AS email FROM logintable WHERE eid = $id;
Basically, I check to see if the email address is not null and
greater than 1 character in length, if there is an "@" sign in it,
and that there aren't any spaces in it. If it fails those three
tests, I check the timestamp of a record, and append one of two
different domains to the login. This worked before with just the
"concat ... blah.com" line as expr2 of the if statement, but when I
try to make expr2 an "if" statement itself, it breaks. Can anyone
tell me if nested ifs aren't allowed, or is my syntax just flat out
wrong?
Thanks in Advance,
Eric
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php