title: Compare current date with birthday in PHP/MySQL
body: <p>I've got the following code which works perfectly well other than one major flaw... It only works if the birthday/anniversary is the same year as current.</p>
  
  <pre><code>&lt;?php
      $query = mysql_query( "SELECT mFN, mSN, TIMESTAMPDIFF(YEAR, mBirthday, CURDATE()) 
      AS mAge, mBirthday FROM memberData WHERE mBirthday BETWEEN CURDATE() + INTERVAL 1 DAY AND CURDATE() + INTERVAL 1 WEEK" );
      while ($rows = mysql_fetch_array($query, MYSQL_ASSOC)) {
          echo sprintf("%s %s will be %s on the %s. &lt;br&gt;", $rows['mFN'], $rows['mSN'], $rows['mAge'], $rows['mBirthday']);
  }
  </code></pre>
  
  <p>So what this does is, compare current date + interval of a week with the birthday stored...</p>
  
  <p>If someones birthday is on the 5th of march 2015, it'll find them!
  Although if someones birthday is on the 5th of march 1995, no luck because of the year... any idea on how i would resolve this? quite new to programming and not sure how to tackle this.</p>
  
  <pre><code>&lt;?php
      $query = mysql_query( "SELECT mFN, mSN, TIMESTAMPDIFF(YEAR, 
     STR_TO_DATE( concat(year(curdate()), '-', month(mBirthday), '-', day(mBirthday) ), '%Y-%m-%d' ) , CURDATE()) 
  AS mAge, mBirthday FROM memberData 
  WHERE 
     STR_TO_DATE( concat(year(curdate()), '-', month(mBirthday), '-', day(mBirthday) ), '%Y-%m-%d' )  
        BETWEEN CURDATE() + INTERVAL 1 DAY AND CURDATE() + INTERVAL 1 WEEK
  
      while ($rows = mysql_fetch_array($query, MYSQL_ASSOC)) {
          echo sprintf("%s %s will be %s on the %s. &lt;br&gt;", $rows['mFN'], $rows['mSN'], $rows['mAge'], $rows['mBirthday']);
  }
  ?&gt;
  </code></pre>
  
  <p>im gettinng Parse error: syntax error, unexpected T_STRING, sprintf line. </p>