How to loop the data[] series with php and mysql -


here table structure.
enter image description here

enter image description here

i using highcharts

here code:

    $(function () {       $('#container_journal').highcharts({          xaxis: {             categories: [                  '1995', '1996', '1997', '1988'         ]         },         yaxis: {             title: {                 text: 'citations'             },             plotlines: [{                 value: 0,                 width: 1,                 color: '#808080'             }]         },         tooltip: {             valuesuffix: ''         },         legend: {             layout: 'vertical',             align: 'right',             verticalalign: 'middle',             borderwidth: 0         },         series: [{             name: 'a + u-architecture , urbanism',             data: [<?php              $test_q = mysql_query("select jour_id, journal, citations, year journ_graph jour_id = '1'");     while($row_q = mysql_fetch_array($test_q)){         $year_q = $row_q['year'];         $citations_q = $row_q['citations'];         echo $citations_q.',';     }         ?>]         },{             name: 'aace international. transactions of annual meeting',             data: [                    <?php              $test_q = mysql_query("select jour_id, journal, citations, year journ_graph  jour_id = '2'");                          while($row_q =  mysql_fetch_array($test_q)){                             $year_q = $row_q['year'];                             $citations_q =  $row_q['citations'];                             echo $citations_q.',';                          }        ?>]          },{             name: 'aacl bioflux',             data: [                    <?php                $test_q = mysql_query("select jour_id, journal, citations, year journ_graph jour_id = '3'");     while($row_q = mysql_fetch_array($test_q)){     $year_q = $row_q['year'];     $citations_q = $row_q['citations'];     echo $citations_q.',';     }          ?>]         }       ?>]       ]     });    }); 

here im entering manually id. in clause(refer code), graph showing. below: enter image description here select jour_id, journal, citations, year journ_graph jour_id = '3' in above statement im entering id manually, need come first table, jour_id.

i tried not working.

   series: [     <?php      $query_jour = mysql_query("select jour_id, journal, citations, year journ_graph");                                                      $query_journ_count = mysql_num_rows($query_jour);                                          while($row_journ = mysql_fetch_array($query_jour)){                                          $jour_id = $row_journ['jour_id'];    ?>     {             data: [<?php            $test_q = mysql_query("select jour_id, journal, citations, year journ_graph jour_id = '$jour_id'");     while($row_q = mysql_fetch_array($test_q)){         $year_q = $row_q['year'];         $citations_q = $row_q['citations'];         echo $citations_q.',';     }     ?>]        }   <?php   }?> 

i have used 2 while loops eventhough not working. please tell me going wrong. please help.

i advice run 1 query database, prepare array contain 3 series, json_encode() in php , data via ajax in javascript. more clearful.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -