Hi guys, I need your help.

Every two months, the day sixteen I need run this query select to recover the rows of previous months.

If tried this version with current date (2013-05-16) I've the correct output:
PHP Code:
mysqlSELECT
    DATE_ADD
(
    
LAST_DAY(
        
DATE_ADD(
            
LAST_DAY(CURDATE()),
            
INTERVAL 180 DAY
        
)
    ),
    
INTERVAL 1 DAY
) AS first_day,
 
LAST_DAY(
    
MAKEDATE(YEAR(CURDATE()) , 40)
) AS 
last_day;
+------------+------------+
first_day  last_day   |
+------------+------------+
2013-01-01 2013-02-28 |
+------------+------------+
1 row in set 
Instead if tried this version with date 2013-07-16 next time, I've this incorrect output; I need this:
PHP Code:
+------------+------------+
first_day  LAST_DAY   |
+------------+------------+
2013-03-01 2013-04-30 |
+------------+------------+ 
But I've this:
PHP Code:
mysqlSELECT
    DATE_ADD
(
    
LAST_DAY(
        
DATE_ADD(
            
LAST_DAY('2013-07-16'),
            
INTERVAL 180 DAY
        
)
    ),
    
INTERVAL 1 DAY
) AS first_day,
 
LAST_DAY(
    
MAKEDATE(YEAR('2013-07-16') , 40)
) AS 
LAST_DAY;
+------------+------------+
first_day  LAST_DAY   |
+------------+------------+
2013-03-01 2013-02-28 |
+------------+------------+
1 row in set 
I would really appreciate any help, thank you very much.