In a date query, does not return a string within a condition well

Hi, I have a query where I find out if a date in the database is empty or not:

Marriage_date’ => ‘if( != 0000-00-00,, “no date recorded”)’,

If I execute the query for example in phpmyadmin, it works, if there is no date it returns “no date recorded” but in cakephp, when recovering in the view the marriage_date field, it returns a numeration that does not make sense, on the other hand if there is date, it returns the correct date. Why not return the string if the date is 0000-00-00?

I think the condition on the code you wrote should be:
'Marriage_date' => !== '0000-00-00' ? : 'no date recored'

Thanks, but the condition is well written and I found the problem to see what I was returning to a JavaScript alert: '<script language = "javascript"> alert ("<? = Marriage_date;?>"); </ Script> '; when making an echo directly on the screen, I realized that I returned the string correctly, I do not know why the alert interpreted something else.