djburner;10990483 wrote:DATE_FORMAT(NOW(),'%m-%d')= DATE_FORMAT(bd),'%m-%d'"; [/CODE]
Careful... look at the right-hand side of that comparison. You're calling DATE_FORMAT() with only a single parameter whereas it expects 2. In addition, you've got a comma and a string following the (erroneous) call to DATE_FORMAT().
This query won't even get executed - you should have gotten an error message from MySQL along the lines of:
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'DATE_FORMAT'
(Let me rephrase... you did get such an error message; whether or not you actually checked for a failing query and/or retrieved and logged the SQL error message, well that's up to you to do.)
djburner;10990483 wrote:RIGHT(NOW(),5)= bd";
Again, carefully read what you're comparing there. On the left-hand side, you've got part of a time (e.g. "16:59" - 16 minutes, 59 seconds), and on the right-hand side you've got an unmodified date.
Thus, you're trying to compare something like "16:59" with "2011-11-03". Notice anything wrong?
(I noticed two things; don't use NOW() if you don't want the time as well, and don't modify/truncate one date value and try to compare it to another unmodified date value.)
djburner;10990483 wrote:it is way difficult to me to understand behind the scenes what is happening
Note you can use SELECT to see the values of expressions. For example, you can simply execute this query:
SELECT RIGHT(NOW(), 8);
in MySQL in case you weren't sure of the output.... which was something like:
mysql> SELECT RIGHT(NOW(),8);
+----------------+
| RIGHT(NOW(),8) |
+----------------+
| 00:23:37 |
+----------------+
1 row in set (0.00 sec)