Hi Eriovaldo, Not many people on this list can help you with PHP, myself included.
But since the PHP code executes on your server, where it generates HTML and JS which is sent to the browser where it is interpreted, it would help to see what HTML and JS is generated by the PHP. Can you look in your browser's debugger and view the source? It might become clear to you what happened in your PHP. On Fri, Jun 1, 2018 at 11:55 AM Eriovaldo Andrietta <[email protected]> wrote: > The issue is : the html code is not executing the php code. > > Em sexta-feira, 1 de junho de 2018 11:47:01 UTC-3, Eriovaldo Andrietta > escreveu: >> >> Why this code is not working fine ? >> I have the php code that generates do jsontable but I cannot use it in >> the html? >> Any idea ? >> >> <html> >> <head> >> <script type="text/javascript" src=" >> https://www.gstatic.com/charts/loader.js"></script> >> <script type="text/javascript" src="// >> ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> >> <script type="text/javascript"> >> google.charts.load('current', {'packages':['corechart']}); >> google.charts.setOnLoadCallback(drawChart); >> function drawChart() >> { >> var data = new google.visualization.DataTable(<?php >> $conn = oci_connect('eri', 'senha123', 'localhost/orcl'); >> if (!$conn) { >> $erro = oci_error(); >> trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); >> } >> $query = oci_parse($conn, "select tipo, tempo from eri"); >> oci_execute($query); >> $rows = array(); >> $table = array(); >> $table['cols'] = array( >> array('label' => 'tipo', 'type' => 'string'), >> array('label' => 'tempo', 'type' => 'int'), >> ); >> $rows = array(); >> while($r = oci_fetch_array($query, OCI_ASSOC+OCI_RETURN_NULLS)) { >> $temp = array(); >> $temp[] = array('v' => (string) $r['TIPO']); >> $temp[] = array('v' => (int) $r['TEMPO']); >> $rows[] = array('c' => $temp); >> } >> $table['rows'] = $rows; >> $jsontable = json_encode($table); >> echo $jsontable; >> ?> >> ); >> >> var options = { >> title:'Sensors Data', >> legend:{position:'bottom'}, >> chartArea:{width:'95%', height:'65%'} >> }; >> >> var chart = new >> google.visualization.LineChart(document.getElementById('line_chart')); >> chart.draw(data, options); >> } >> </script> >> <style> >> .page-wrapper >> { >> width:1000px; >> margin:0 auto; >> } >> </style> >> </head> >> <body> >> <div class="page-wrapper"> >> <br /> >> <h2 align="center">SHOW 1 - Display Google Line Chart with JSON PHP & >> Oracle </h2> >> <div id="line_chart" style="width: 100%; height: 500px"></div> >> </div> >> </body> >> </html> >> > -- > You received this message because you are subscribed to the Google Groups > "Google Visualization API" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to > [email protected]. > Visit this group at > https://groups.google.com/group/google-visualization-api. > To view this discussion on the web visit > https://groups.google.com/d/msgid/google-visualization-api/4d530bf7-5bde-45ff-81f2-206ec4084ec9%40googlegroups.com > <https://groups.google.com/d/msgid/google-visualization-api/4d530bf7-5bde-45ff-81f2-206ec4084ec9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2> [email protected] <[email protected]> 5CC, Cambridge MA -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-visualization-api. To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/CAOtcSJPGN9qx5UnbLphKYT_qJvFBqBKXS%2BUnf623zc1fu%3DNBkA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
