Ask another question about the PHP array format. Thanks for answering the previous array question xuzuning. I want to ask another question. can I do this if I put the type value in the table into the array?
Use the above table to implement the following array
Array ([classname] => array ([0] => [1] => wedding service [2] => mechanical equipment [3] => hospital medical service [4] => lighting and lighting [5] => education and training [6] => chemical coatings [7] => beauty and fitness [8] => catering and food [9] => Car Services) [layout] => array ([0] => [1] => regular [2] => two columns [3] => three columns [4] => grid ))
Reply to discussion (solution)
In my words, $ res is the format you want now.
This post requires a subscript array.
$ Res = array_values ($ res );
$classname="select * from table where type='classname'";$layout="select * from table where type='layout'";
In my words, $ res is the format you want now.
This post requires a subscript array.
$ Res = array_values ($ res );
Xuzuning I just tried it out. thank you, that is, the format $ res is used. there is another problem, what if I want to replace the "unlimited" word with a null value when I want to output it?
In all your previous descriptions, there are no "unlimited" words.
In all your previous descriptions, there are no "unlimited" words.
Sorry, I just found that the uploaded graph data is old. The typevalue of type = 0 is "unlimited ". Or is that okay? It is how to replace the typevalue of the corresponding row with a null value when type = 0 in the output result of the array.
While ($ row = mysql_fetch_assoc ($ rs )){
If ($ row ['typeid'] = 0) $ row ['typevalue'] = '';
$ Res [$ row ['type'] [] = $ row ['typevalue'];
}
While ($ row = mysql_fetch_assoc ($ rs )){
If ($ row ['typeid'] = 0) $ row ['typevalue'] = '';
$ Res [$ row ['type'] [] = $ row ['typevalue'];
}
Thank you very much.