Hi,
I have a Mysql database and following the examples provided I can’t get it to work on loading a simple datatable. If I run my php script by itself I get the following results
[{“FLAG_ID”:“1”,“FLAG_TYPE”:“OK”},{“FLAG_ID”:“2”,“FLAG_TYPE”:“PARTS ON BACK ORDER”},{“FLAG_ID”:“3”,“FLAG_TYPE”:“PART FAIL”},{“FLAG_ID”:“4”,“FLAG_TYPE”:“WAITING ON CUSTOMER”},{“FLAG_ID”:“5”,“FLAG_TYPE”:“IT PROBLEM”},{“FLAG_ID”:“6”,“FLAG_TYPE”:“PARTS MISSING”},{“FLAG_ID”:“7”,“FLAG_TYPE”:“IWI PROBLEM”}]
If I run it through the webix program all I get is the hearders. Here is my webix program
Loading from an external data file <script type="text/javascript" charset="utf-8">
webix.ready(function(){
grida = new webix.ui({
container:"testA",
view:"datatable",
columns:[
{ id:"FLAG_ID", header:"ID", width:50, height:50},
{ id:"FLAG_TYPE", header:"FLAG_TYPE",width:200, height:50},
],
autoheight:true,
autowidth:true,
url:"query_data_2.php"
});
});
</script>
</body>
and here is my php file that works independently.
<?php // CONNECT TO THE DATABASE $DB_NAME = 'floor_tracker'; $DB_HOST = 'localhost'; $DB_USER = 'mysecret_user_name'; $DB_PASS = 'mysecret_user_password'; $mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); if (mysqli_connect_errno()) { printf("Connect failed: %s\ ", mysqli_connect_error()); exit(); } //query status_flag table $query = "SELECT * FROM status_flag"; $res = $mysqli->query($query); //convert data to json $data = array(); while ($rec = $res->fetch_array(MYSQL_ASSOC)) //each row $data[] = $rec; //output json echo json_encode($data); // CLOSE CONNECTION $res->close(); $mysqli->close();