i am trying to send JSON data to PHP server, but i can understand how can i parse my JSON in PHP and insert values in Mysql database.
Here is how looks my JSON data
{"reps_list":{"selected_subcategory_id":[0,1,2]}}
Here is my PHP code:
$reps_list = $_POST['reps_list'];
$reps_list= json_decode($reps_list,TRUE);
for($i = 0; $i <= count($array['reps_list']['selected_subcategory_id']); $i++){
mysqli_query($conn, "INSERT INTO reps VALUES(NULL, '".$array['reps_list']['selected_subcategory_id'][i]."', 1, 1 )");
}
Any Suggestions?
json_decode, but it's not so you can't.json_decode()does not protect values.