php - SQL query to Google's JSON format -


i have posted code snippet few days ago this problem. try examine problem side.

so, have query , fill in json file output. contains more records, not one. problem is, code, have found / have wrote paste first record file cols. think there no existing tutorial problem.

update: sample output:

array ( [cols] => array     (         [0] => array             (                 [id] =>                  [label] => name                 [pattern] =>                  [type] => string             )          [1] => array             (                 [id] =>                  [label] => start                 [pattern] =>                  [type] => date             )          [2] => array             (                 [id] =>                  [label] => end                 [pattern] =>                  [type] => date             )      )  [rows] => array     (         [0] => array             (                 [c] => array                     (                         [0] => array                             (                                 [v] => x                             )                          [1] => array                             (                                 [v] => date(2014,08,18,21,00,00)                             )                          [2] => array                             (                                 [v] => date(2014,08,18,23,00,00)                             )                      )              )          [1] => array             (                 [c] => array                     (                         [0] => array                             (                                 [v] => y                             )                          [1] => array                             (                                 [v] => date(2014,08,18,21,00,00)                             )                          [2] => array                             (                                 [v] => date(2014,08,18,22,00,00)                             )                      )              )          [2] => array             (                 [c] => array                     (                         [0] => array                             (                                 [v] => z                             )                          [1] => array                             (                                 [v] => date(2014,08,18,23,00,00)                             )                          [2] => array                             (                                 [v] => date(2014,08,18,23,30,00)                             )                      )              )      )  ) 

solution: character encoding problem, can detected json_last_error() method:

                switch (json_last_error()) {                 case json_error_none:                     echo ' - no errors';                 break;                 case json_error_depth:                     echo ' - maximum stack depth exceeded';                 break;                 case json_error_state_mismatch:                     echo ' - underflow or modes mismatch';                 break;                 case json_error_ctrl_char:                     echo ' - unexpected control character found';                 break;                 case json_error_syntax:                     echo ' - syntax error, malformed json';                 break;                 case json_error_utf8:                     echo ' - malformed utf-8 characters, possibly incorrectly encoded';                 break;                 default:                     echo ' - unknown error';                 break;                 } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -