Advertisement
DiegoWilson

Untitled

Dec 20th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <?php
  2. include("../../capaDatos/conexion.php");
  3.  
  4. $conect = new Conexion();
  5.  
  6. $link = $conect->conectar();
  7. $logrado="L";
  8. $nologrado="NL";
  9. $codigoCurso = "1324";
  10.  
  11. $sql = " select codCurso, count(estado) as Logrado , (Select count(estado) from estadisticas where estado='$nologrado' and codCurso='$codigoCurso') as NoLogrado from estadisticas where estado='$logrado' and codCurso='$codigoCurso'  ";
  12.  
  13. $result =  mysqli_query($link ,$sql) or die (mysqli_error());
  14.  
  15. $rows = array();
  16. $tabla = array();
  17.  
  18. $tabla['col'] = array(
  19.    
  20.     array('label' => 'codCurso', 'type' => 'string'),
  21.     array('label' => 'Logrado', 'type' => 'number'),
  22.     array('label' => 'No Logrado', 'type' => 'number')
  23.  
  24. );
  25.  
  26. $rows = array();
  27.  
  28. while($r = mysqli_fetch_assoc($result) ) {
  29.     $temp = array();
  30.     // the following line will be used to slice the Pie chart
  31.     $temp[] = array('v' => (string) $r['codCurso']);
  32.  
  33.     // Values of each slice
  34.     $temp[] = array('v' => (int) $r['Logrado']);
  35.     $temp[] = array('v' => (int) $r['NoLogrado']);
  36.    
  37.     $rows[] = array('c' => $temp);
  38. }
  39.  
  40. $tabla['rows'] = $rows;
  41.  
  42. $jsonTable = json_encode($tabla);
  43.  
  44. //echo $jsonTable;
  45.  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement