title: Insert number of days into database according to month
body: <p>I've a table <code>tbl_month</code> with col <code>month</code> and <code>year</code> containing values like</p>
  
  <pre><code>month    year
    1      2015
    2      2015
    3      2015
    4      2015
    5      2015
  ............
    12     2015
  </code></pre>
  
  <p>From above table, I'm fetching month and year and want to insert the number of days into table <code>tbl_days</code> according to month, so far I be able to insert 30 days with following code:</p>
  
  <pre><code>for($count=1;$count&lt;31;$count++) {
      $query="INSERT INTO tbl_days (day_no, brand_id) VALUES ('".$count."','".$_POST['brand_id_'.$count]."')";
      mysql_query($query);
  }
  </code></pre>
  
  <p>How can I insert number of days according to month into table <code>tbl_days</code> e.g for month 12 (December),  31 days and if month 1 (January) again 31 days but for month 2 (Feb) 28 days and if leap year (Feb) 29 days?</p>