0

I have a php page that does the query like the one below

$sql   = "SELECT dog_name, dog_breed FROM breeds"; //die($sqlnum);
$res   = mysqli_query($GLOBALS['link'],$sql);
while($row = mysqli_fetch_assoc($res)){
    $breeds[] = $row['dog_breed'];
}

I'd like to pass the result to js file Here's my code in the js file

var description = $breeds;   <----dont know if this is correct ^_^
var PieData = [
{
  value: description['0'],
  color: "#f56954",
  highlight: "#f56954",
  label: "Pitbull"
}]

How can i achieve this.

Explanation for duplicate:

I have a separate Php file which is called index.php and a separate js file which called dashboard2.js

Ligthers
  • 217
  • 1
  • 4
  • 10

0 Answers0