i know question has been asked many times have not found solution code. choose supplier , year , want display list of products. suppliers works others no.
after many tests found code works suppliers except suppliers name quotes , acccents.
here error:
"data column(s) axis #0 cannot of type string"
code:
<script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", { packages: ["corechart"] }); google.setonloadcallback(drawchart); function drawchart() { var data = google.visualization.arraytodatatable([ ['month', 'product', 'items'], <?php foreach ($my_data $a => $b): ?> ['<?php echo $month[$b[' month ']]?>', <?php echo $b['product'] ?>, <?php echo $b['items'] ?>, ], <?php endforeach; ?> ]); var options = { title: 'supplier', haxis: { title: 'product supplier', titletextstyle: { color: '#333' } }, vaxis: { minvalue: 0 } }; var chart = new google.visualization.areachart(document.getelementbyid('chart_div')); chart.draw(data, options); } </script> this's query :
if(isset($_post['$value1'] )) { $month = array('','january','february ','march','april','may','june','july','august','september','october','november','december'); $value1 = $_post['$value1'] ; $value2 = $_post['$value1'] ; $sql=" select name, count(items), month(created_at) month, year(created_at) year, sum(product) product `supplier_product` name = '".$value1."' , year(date.created_at) = '".$value2."' group name,month order month asc "; this code php :
<label for="supplier"> select name : </label> <select name = "value1" id="sup"> <?php $sql = "select name supplier_product"; $req = $mydatabase->prepare($sql); $req->execute(); $data = $req->fetchall(pdo::fetch_assoc); foreach ($data $a => $b): ?> <option value="<?php echo utf8_encode($v['name']); ?>"><?php echo utf8_encode($v['name']); ?></option> <?php endforeach; ?> </select> <select name= "value2"> <option value="2015">2015</option> <option value="2014">2014</option> <option value="2014">2013</option> <option value="2014">2012</option> <option value="2014">2011</option> <option value="2014">2010</option> <option value="2014">2019</option> </select> help me please. many help.
here solution of question added addslashes , utf8_decode works now.
$value1 = addslashes(utf8_decode($_post['value1 ']));
Comments
Post a Comment