Convert PHP variable to Java variable

I have three PHP $variables from a MySQL table. How do I plug them into this Google Chart Java code? For example: 47 = $yup; 44 = $nope; 9 = $huh

    // Create the data table.
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Response');
    data.addColumn('number', 'Count');
    data.addRows([
      ["Yes", 47],
      ["No", 44],
      ["No opinion", 9],
    ]);

Thanks . . .

It is more easy then you think since php will be executed serverside and the result will be send to the browser.

<?php
$yup = 47;
$nope = 44;
$huh = 9;
?>
<script>
    // Create the data table.
    var data = new google.visualization.DataTable();
    data.addColumn('string', 'Response');
    data.addColumn('number', 'Count');
    data.addRows([
      ["Yes", <?php echo $yup; ?>],
      ["No", <?php echo $nope; ?>],
      ["No opinion", <?php echo $huh; ?>],
    ]);

</script>

Thank you, Frank. I am very grateful.

Your solution is perfect . . .

Sponsor our Newsletter | Privacy Policy | Terms of Service