ColdFusion Lists wrote:

Hi
my table have an field when users can enter any chars....
If users dont send any content for that field(phone), mysql store "( ) - "
without quotes in that....


What im looking for:
Display IF phone field is ( ) - NOT ENTER
Otherwise display the phone of user.
It's possible? Using IF clause Mysql give me an error - maybe
IF(`users`.`phone` IS '( ) - ','NOT ENTER',`users`.`phone`) AS phonefield;
What's happened?
Thanx for your time

In general, you should post your query and the error message you received. That would help us help you.


I expect the problem is your use of "IS" as a comparison operator in place of "=". That won't work. IS only works as part of IS NULL or IS NOT NULL.

I expect you want something like

  SELECT IF(users.phone = '(   )   - ','NOT ENTER',users.phone) phonefield
  FROM users;

It might be better if you modified your application to store NULL instead of "( ) - " when no phone number is entered, or to require a phone number be entered, whichever is appropriate. In the former case (you store NULLs), you would change the above query to:

  SELECT IF(users.phone IS NULL,'NOT ENTER',users.phone) phonefield
  FROM users;

Michael



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to