Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Update:</strong></p> <p>Have a look at how you can add data to the chart. You have the possibility to <a href="http://code.google.com/apis/visualization/documentation/reference.html#DataTable_literal_constructor_example" rel="nofollow noreferrer">add data in JSON</a>.</p> <p>The only thing you have to do is to prepare a corresponding PHP array. Then you can serialize this array and set the data. E.g.</p> <pre><code>&lt;?php // $data is an array and already has the correct structure... $jdata = json_encode($data); ?&gt; &lt;!-- later ... --&gt; &lt;script type='text/javascript'&gt; google.load('visualization', '1', {'packages': ['geomap']}); google.setOnLoadCallback(drawMap); function drawMap() { var data = new google.visualization.DataTable(&lt;?php echo $jdata ?&gt;); var options = {}; options['dataMode'] = 'regions'; var container = document.getElementById('map_canvas'); var geomap = new google.visualization.GeoMap(container); geomap.draw(data, options); }; &lt;/script&gt; </code></pre> <p>I recommend to read the documentation / <a href="http://code.google.com/apis/visualization/documentation/reference.html" rel="nofollow noreferrer">API reference</a>. I basically found this just by searching...</p> <hr> <p>Without further information we cannot give a specific answer but a general approach is:</p> <p>Assuming that you already fetched the records from your DB in a result set <code>$results</code> than you can just loop over it:</p> <pre><code>&lt;?php foreach($results as $row): ?&gt; data.setValue(&lt;?php echo $row['column1']; ?&gt;, &lt;?php echo $row['column2']; ?&gt;); // depends on what type of char you want to create, on your actual data etc. &lt;?php endforeach; ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload