I have database with Name, email, joindate and my Query is

$name=$_POST['txtname'];
$email=$_POST['txtemail'];
$date = date("Y/m/d");

INSERT INTO member (name,email,joindate) VALUES ('$name', '$email', '$date')

What should be the output query to get all data by month?

Try this

<?php
$result = mysql_query("SELECT   DATE_FORMAT(`joindate`,'%m/%Y') AS MonthYear   FROM  member GROUP BY YEAR(joindate), MONTH(joindate);");

while($row = mysql_fetch_array($result))
  {
     echo '<h2>'.$row['MonthYear'].' </h2>';
     $resultTwo = mysql_query("SELECT   *  FROM  member WHERE DATE_FORMAT(`joindate`,'%m/%Y') = '{$row['MonthYear']}';");
     while($rowTwo = mysql_fetch_array($resultTwo)) {
        echo '<p>Member: '.$rowTwo['name'].' </p>';
        echo '<p>Email: '.$rowTwo['email'].' </p>';
        echo '<p>Joindate: '.$rowTwo['joindate'].' </p><hr />';
     }
  }
?>

its showing blank

There's probably an error somewhere. Check your error_log, or add error checking to your query.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.