Is there a problem with this code? function getCategoryMapSelectly ($ tbl, $ cid ){
Global $ DB;
$ Return = '';
$ Ii = 1;
$ Arr = explode (',', $ cid );
Foreach ($ arr as $ k =>$ v ){
If (! $ V)
Unset ($ arr [$ k]);
}
Foreach ($ arr as $ value ){
$ Newarr [] = $ value;
}
For ($ I = 0; $ I
$ Arr_cat = $ DB-> get_result_array ($ tbl, '*', "WHERE id = '$ newarr [$ I]'");
Print_r ($ newarr );
}
Foreach ($ arr_cat as $ arr ){
$ Return. =' '. $ Arr ['title'].'';
$ Ii ++;
}
Return $ return;
}
Reply to discussion (solution)
$ Ii seems meaningless
No syntax error
Let's talk about your problem.
1. the first three cycles can be merged into one;
2. in the third loop, $ arr_cat is always assigned a value, instead of appending data. as a result, only the last data in the last loop is obtained;
3. I guess you want to pull down the data, that is, the option label instead of the select label.
No syntax error
Let's talk about your problem.
This method is used to split the value obtained from the left into groups and display a new array to the right.
The array on the left displays 1, 2, 3, 4, and click add to add 3, 2, 4, and 1.
However, if this method is not used, the value cannot be displayed.
1. the first three cycles can be merged into one;
2. in the third loop, $ arr_cat is always assigned a value, instead of appending data. as a result, only the last data in the last loop is obtained;
3. I guess you want to pull down the data, that is, the option label instead of the select label.
Yes. The data is to be pulled down.
I didn't pay attention to it. now I changed it to option. that's the second question you mentioned.
1. the first three cycles can be merged into one;
2. in the third loop, $ arr_cat is always assigned a value, instead of appending data. as a result, only the last data in the last loop is obtained;
3. I guess you want to pull down the data, that is, the option label instead of the select label.
This is the problem. The right side should be in the first position, but now it is in the last position.