Hello!
I’m having trouble loading JSON data to my grid
I have a grid.
Its load line looks like…
myGrid4.load("./analytics1/Query_time2.php",“js”);
Query_time2.php looks like…
<?php //this is the 'connector' of sorts. require_once('config_dp1.php'); header("Content-type: application/json"); $select = mysql_query("SELECT blah from blah where blah etc."); $rows=array(); while($row=mysql_fetch_array($select, MYSQL_BOTH)) { $rows[] = $row; } echo json_encode($rows) ?>The returned JSON data looks like…
[{
“0”: “1670”,
“time_ID”: “1670”,
“1”: “testtest”,
“legacy_tech_name”: “testtest”,
“2”: “2015-12-12”,
“time_date_worked”: “2015-12-12”,
“3”: “asdfasdf”,
“legacy_billable_text”: “asdfasdf”,
“4”: “Hoffman”,
“legacy_customer_name”: “Hoffman”,
“5”: “0.7500”,
“hoursWorked”: “0.7500”,
“6”: “”,
“legacy_task_ID”: “”
}, {
“0”: “1667”,
“time_ID”: “1667”,
“1”: “test”,
“legacy_tech_name”: “test”,
“2”: “2015-12-05”,
“time_date_worked”: “2015-12-05”,
“3”: “test”,
“legacy_billable_text”: “test”,
“4”: “test”,
“legacy_customer_name”: “test”,
“5”: “4.0000”,
“hoursWorked”: “4.0000”,
“6”: “”,
“legacy_task_ID”: “”
},
There’s like 4 pieces of data per single cell. 1. the number 2.the data 3. the column-header 4. the data AGAIN.
Any ideas?
How do I fix this? I’m JUST figuring out the whole JSON thing, failing every step of the way.
Thanks!
Hope to hear from someone soon!