Create nested json object using php mysql

后端 未结 2 1188
没有蜡笔的小新
没有蜡笔的小新 2020-12-10 05:19

I have two tables, table 1 has 2 fields (question_pk, question_name) and table 2 has 4 fields(ans_pk, options, question_fk and right_answer). I want to create json l

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-10 06:12

    Hi try this,

     $opt_fet['options'],
                    'right_ans' => $opt_fet['right_ans'],
                );
    
            }
            array_push($json_response, $row_array); //push the values in the array
        }
        echo json_encode($json_response);
    }
    ?>    
    

提交回复
热议问题