Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle chart using jsp with json mysql
    text
    copied!<p>I am looking for the Google chart using JSP, JSON with MYSQL as data source..<br/> I checked but I didn't get any working example... <br/>I got some of the PHP example and that is working also.... but I need that in JSP....<br/> I tried some of the example but in that its giving error like.... <br/> <b> Column not found </b><br/> Json format for google chart :<br/> PHP Code :<br/></p> <pre><code>&lt;?php include_once 'settings/config2.php'; $sth = mysql_query("SELECT * FROM captcha"); $rows = array(); $flag = true; $table = array(); $table['cols'] = array( array('label' =&gt; 'word', 'type' =&gt; 'string'), array('label' =&gt; 'cap', 'type' =&gt; 'number'), array('label' =&gt; 'id', 'type' =&gt; 'number') ); $rows = array(); while($r = mysql_fetch_assoc($sth)) { $temp = array(); $temp[] = array('v' =&gt; (string) $r['word']); $temp[] = array('v' =&gt; (int) $r['captcha_time']); $temp[] = array('v' =&gt; (int) $r['captcha_id']); $rows[] = array('c' =&gt; $temp); } $table['rows'] = $rows; $jsonTable = json_encode($table); echo $jsonTable; ?&gt; </code></pre> <p><b>Output:</b><br/></p> <pre><code>{"cols":[{"label":"word","type":"string"},{"label":"cap","type":"number"}, "rows":[ {"c":[{"v":"zmQUtTxm"},{"v":1382242835}]},{"c":[{"v":"6QCCtIt0"},{"v":1382242846}]}, {"c":[{"v":"OVHqIrHH"},{"v":1382242923}]},{"c":[{"v":"PvvaKdwS"},{"v":1382242933}]}, {"c":[{"v":"O9Gh4oVl"},{"v":1382243745}]},{"c":[{"v":"NI6hsJKa"},{"v":1382243785}]}, {"c":[{"v":"3Mcc6sPC"},{"v":1382245480}]},{"c":[{"v":"1wDmZlXv"},{"v":1382245612}]}]} </code></pre> <p><br/> I need same thing in JSP. <br/> I got some json format here :<br/> <a href="https://stackoverflow.com/questions/5981647/how-do-i-create-a-multidimensional-hashmap-or-hashtable-in-jsp-java-and-conver">How do I create a multidimensional HashMap or Hashtable in JSP / Java and convert it to a JSON object?</a> </p> <p><br/> but i needed in above format...<br/> Thank you</p>
 

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