title: MySQL: Count the rows per day and show the results date and count on graph?
body: <p>I have a table with an INT column containing numbers, and a date column. I want to be able to count the number of same date columns are there per day. That is, how many distinct date rows there are in each day. So, for example, if an date has a record twice or thrice, it's count should be displayed on graph with date on X-Axis and count on Y-Axis </p>
  
  <p>Example Data:</p>
  
  <pre><code>ID     date picker
  1     02-Apr-2014
  2     02-APR-2014
  3     04-APR-2014
  4     07-APR-2014
  5     07-APR-2014
  6     07-Apr-2014
  </code></pre>
  
  <p><br/>
  which graph Should i use to get this required output on graph ???</p>
  
  <p>My php code i used ::</p>
  
  <pre><code>    &lt;?php
  include("phpgraphlib/phpgraphlib.php");
  include("phpgraphlib/phpgraphlib_stacked.php");
  $graph=new PHPGraphLib(550,350); 
  $link = mysql_connect('localhost', 'root', '')
     or die('Could not connect: ' . mysql_error());
  
  mysql_select_db('ac_xamp_le') or die('Could not select database');
  
  $dataArray=array();
  
  //get data from database
  $sql="select datepicker, count(id) from ac_member group by datepicker";
  $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
  if ($result) {
    while ($row = mysql_fetch_assoc($result)) {
        $date=$row["datepicker"];
        $count=count('id');
  
        //add to data areray
        $dataArray[$date]=$count;
    }
  }
  
  //configure graph
  
  $graph-&gt;addData($dataArray);
  $graph-&gt;setTitle("Enquires by date");
  $graph-&gt;setLine(true);
  $graph-&gt;setLineColor("navy");
  $graph-&gt;setLineColor("255,255,0");
  $graph-&gt;setLineColor("#339900");
  $graph-&gt;setDataValues(true);
  $graph-&gt;setGradient("blue", "navy");
  $graph-&gt;setBarOutlineColor("black");
  $graph-&gt;createGraph();
  
  ?&gt;
  </code></pre>