Google Gantt Chart Using While Loop In PHP
<p>i want to display multiple google gantt chart using while loop in php but this code only showing 1 gantt chart ( the first one). i want to display all the chart with loop so i will retrieve the data from database and show in every table row with chart</p>

<pre><code>    &lt;table&gt;
    &lt;?php 
      $i=0;
      while($i&lt;4){
      echo"
        &lt;script &gt;
        google.charts.load('current', {'packages':['gantt']});
        google.charts.setOnLoadCallback(drawChart);

    function drawChart() {

      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Task ID');
      data.addColumn('string', 'Task Name');
      data.addColumn('string', 'Resource');
      data.addColumn('date', 'Start Date');
      data.addColumn('date', 'End Date');
      data.addColumn('number', 'Duration');
      data.addColumn('number', 'Percent Complete');
      data.addColumn('string', 'Dependencies');

      data.addRows([
        ['2014Spring', 'Spring 2014', 'spring',
         new Date(2014, 2, 22), new Date(2014, 5, 20), null, 100, null],
        ['2014Summer', 'Summer 2014', 'summer',
         new Date(2014, 1, 12), new Date(2014, 2, 20), null, 100, null],
         ['2015Winter', 'Winter 2015', 'winter',
         new Date(2015, 11, 21), new Date(2016, 2, 21), null, 0, null],

      ]);

      var options = {
        height: 200,
        gantt: {
          trackHeight: 25
        }
      };

          var chart = new       google.visualization.Gantt(document.getElementById('chart_div$i'));

      chart.draw(data, options);
    }
  &lt;/script&gt;

  &lt;tr&gt;


     &lt;td&gt;    Hello &lt;/td&gt;
      &lt;td id='chart_div$i'&gt;&lt;/td&gt;

      &lt;/tr&gt;

      ";
      $i++;
      }
    ?&gt;

&lt;/table&gt;
</code></pre>

<p>please help me out an dpoint out where i am doing wrong 
thanks</p>