Return a JSON object using PHP json_encode() & MySQL to pass to jQuery function

后端 未结 3 1139
攒了一身酷
攒了一身酷 2021-02-02 04:16

I\'m trying to create a json object from MySQL results, but not getting the result I need.

Here is the PHP

$json = array();
$result = m         


        
3条回答
  •  -上瘾入骨i
    2021-02-02 05:02

    You start by defining an array.

    You then generate some JSON manually.

    You then convert the array to JSON and output it.

    Replace all the echo statements in and at the edge of your while loop with code to generate an associative array containing the data, and then insert it into $json.

提交回复
热议问题