Hello.
There is such a code
foreach($sett as $k=>$v){ foreach($v["funcsPole"] as $k1=>$v1){ if($v1=="")unset($v["funcsPole"][$k1]); } $tmp=json_encode($v); $db->Query("UPDATE `fields` SET params='".$tmp."' WHERE id=$k AND zone_id=$zone_id"); }
The $ sett set is passed through the form, it has 6 values, all absolutely identical. But when encoding it in JSON It turns out this result:
array(6) { [1]=> object(stdClass)#3 (4) { ["numPole"]=> string(4) "wera" ["namePole"]=> string(3) "asd" ["funcsPole"]=> array(4) { <- тут [0]=> string(5) "cam_4" [1]=> string(5) "cam_3" [2]=> string(5) "cam_4" [3]=> string(5) "cam_5" } ["priorPole"]=> string(2) "32" } [2]=> object(stdClass)#4 (4) { ["numPole"]=> string(3) "wer" ["namePole"]=> string(4) "werr" ["funcsPole"]=> object(stdClass)#5 (2) { <- тут ["0"]=> string(5) "cam_3" ["2"]=> string(5) "cam_4" } ["priorPole"]=> string(0) "" }
That is, what is allocated (<- here), for the first value of the array is encoded as an array, and in the second value as an object. With what it can be connected?
The form has 6 sections, each section is passed as an element of the array