This was helpfull!
I just changed my HTML doc to PHP, and then IT WORKS!
I am a rookie in code-develeper stuff, but my tip por MySQL cx is this.
Query:
<?php
session_start();
include_once "con.php"; #my conex in another doc
$query= "SELECT * FROM data ORDER BY id";
$result= mysql_query($query);
#For a simple first look, or rookies like me... I show the query result w/ an echo.
while ($row= mysql_fetch_assoc($result)){
echo $row['id'] . ' | ' . $row['mes'] . ' | ' . $row['valor1'] . ' % | ' . $row['valor2'] . ' % | ' . $row['valor3']. ' %' ."\n";
#This is what we need: I put data from my query in $setx, and then I use user3271851's code... it works!
$set1= $row['valor1'];
$set2= $row['valor2'];
$set3= $row['valor3'];
}
?>
For the Chart, just like the post:
var pieData = [
{
value: <?php echo $set1; ?>,
color:"#F38630"
},
{
value : <?php echo $set2; ?>,
color : "#E0E4CC"
},
{
value : <?php echo $set3; ?>,
color : "#69D2E7"
}
];
var myPie = new Chart(document.getElementById("canvas").getContext("2d")).Pie(pieData);
P.S.: Sorry, my english is not good at all. :)