title: How to show unique dates when outputting data to charts in php
body: <p>Based on a answer I got earlier from @WhiteHat (Thank you) I cannot seem to get the dates to show unique so I made this a new question as its an extension question..</p>
  
  <p>I have a DB that has 3 columns - date, visits, sold.. Visit values are strings yes or no as well as sold = yes or no..I would like to display how many leads and sold for each day of the month. The db has a new row for each lead and sold so there are multiple dates that are duplicated for each lead and sold. </p>
  
  <p>It throws this error - Uncaught Error: Type mismatch. Value 1 does not match type number in column index 1</p>
  
  <pre><code>&lt;?php
  $json = array();
  $sql = "SELECT date, sum(case when visit = 'Yes' then 1 else 0 end) as 'visit', sum(case when sold = 'Yes' then 1 else 0 end) as sold FROM customers    WHERE source = 'website' group by date ORDER BY date ASC";
  $result = $conn-&gt;query($sql);
  if ($result-&gt;num_rows &gt; 0) {
    while($row = $result-&gt;fetch_assoc()) {
      $sold = $row["sold"];
      $visit = $row["visit"];
      $date = $row["date"];
      $time = strtotime($date);
      $ndate = date("m/d", $time);
        $dataRow = array(
            $ndate,
            $row['visit'],
            $row['sold'],
        );
        array_push($json, $dataRow);
    }
    }
    $jsonstring = json_encode($json);
   ?&gt;
  </code></pre>
  
  <p>Here is the chart script</p>
  
  <pre><code>&lt;script src="https://www.gstatic.com/charts/loader.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt;
    google.charts.load('current', {
  'callback': function () {
    var data = google.visualization.arrayToDataTable([
      [{type: 'string', label: 'Date'}, {type: 'number', label: 'Leads'}, {type: 'number', label: 'Sold'}]
    ]);
  
    data.addRows(&lt;?= $jsonstring ?&gt;);
  
    var options = {
      title: 'Internet Performance',
      curveType: 'function',
      legend: { position: 'top' }
    };
  
    var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
    chart.draw(data, options);
  },
  'packages': ['corechart']
  });
  &lt;/script&gt;
  
  &lt;div id="curve_chart" style="width: 1900px; height: 500px"&gt;&lt;/div&gt;
  </code></pre>