mysql - date and time query in php -


i'm trying select records has same month current month.

 $date=date('y-m-d');      $month=substr($date,5,2);       $res=mysql_query("select date reports");     while($row=mysql_fetch_assoc($res)){      $months=substr($row['date'],5,2);  } 

how can it?

you sql let handle this

$query = "select date reports month(date) = ".date("m"); 

in case want of month this year query this:

$query = "select date reports year(date) = ".date("y")." month(date) = ".date("m"); 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -