D3 Bar Chart Troubleshooting
<p>I have a database with 5 columns, ID, customerName, dateYear, dateMonth, and dateDay. The date columns are added into the database when the user sends the form. So for example if a user sent the form today the 3 columns would have 2016, June, and 7. I want to make a D3 bar chart that can pull this information and display how many forms were sent each month/year. I have a list of checkboxes in HTML for the admin to select one or more months, and a year. </p>

<pre><code>        &lt;input type="submit" name="monthlyReport" value="Generate a Monthly Report for:" /&gt;
        &lt;br&gt;
        &lt;input type="checkbox" value="January" name="monthList[]"/&gt;January
        &lt;br&gt;
        &lt;input type="checkbox" value="February" name="monthList[]"/&gt;February
</code></pre>

<p>etc...</p>

<pre><code>&lt;select name="selyear1"&gt;
    &lt;option value="2016"&gt;2016&lt;/option&gt;
    &lt;option value="2017"&gt;2017&lt;/option&gt;
    &lt;option value="2018"&gt;2018&lt;/option&gt;
    &lt;option value="2019"&gt;2019&lt;/option&gt;
    &lt;option value="2020"&gt;2020&lt;/option&gt;
&lt;/select&gt;
</code></pre>

<p>Here is my PHP code that takes the user input and turns it into a query: </p>

<pre><code>$monthList = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$yearList = array("2016", "2017", "2018", "2019", "2020");

$monthlyReport = isset($_POST["monthlyReport"]) ? $_POST["monthlyReport"] : "";
$monthList = array();
$monthList = isset($_POST["monthList"]) ? $_POST["monthList"] : "";
$selectedYear = isset($_POST["selyear1"]) ? $_POST["selyear1"] : "";
if(isset($monthlyReport) &amp;&amp; !empty($monthList) &amp;&amp; in_array($selectedYear, $yearList)) {
    foreach ($monthList as $month){ 
        if (in_array($month, $monthList)) {

            $stmt = $conn-&gt;prepare("SELECT dateYear, dateMonth FROM just_ink WHERE dateMonth = :month AND dateYear= :year");
            $stmt-&gt;execute(array(":month" =&gt; $month, ":year"=&gt; $selectedYear));
            $result[] = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC);

        }
    }
}
var_dump($result);
</code></pre>

<p>$result will dump this: </p>

<pre><code>array(2) { [0]=&gt; array(1) { [0]=&gt; array(2) { ["dateYear"]=&gt; string(4) "2016" ["dateMonth"]=&gt; string(7) "January" } } [1]=&gt; array(2) { [0]=&gt; array(2) { ["dateYear"]=&gt; string(4) "2016" ["dateMonth"]=&gt; string(4) "June" } [1]=&gt; array(2) { ["dateYear"]=&gt; string(4) "2016" ["dateMonth"]=&gt; string(4) "June" } } }
</code></pre>

<p>So how exactly do I turn this result into the D3 bar chart? I've look at the d3Noob tips and tricks but this is a more advanced case I believe. Thanks ahead of time for the responses! </p>