I have one of the following tables
Excuse me, how can I get him to output the following array format according to type and typeid? Thank you
Array ( [0] = Array ( [0]=> [1]=> Wedding service [2]=> Machinery Equipment [3]=> Hospital Medical [4]=> Lighting [5]=> Education and training [6]=> Chemical paint [7]=> Beauty fitness [8]=> food [9]=> Car service ) [1] = = Array ( [0]=> [1]= > General [2]=> two columns [3]=> three columns [4]=> grid ))
Reply to discussion (solution)
Read after query
while ($row = Mysql_fetch_assoc ($rs)) { $res [$row [' type '] [] = $row [' Typevalue '];} $res = Array_values ($row);
Read after query
while ($row = Mysql_fetch_assoc ($rs)) { $res [$row [' type '] [] = $row [' Typevalue '];} $res = Array_values ($row);
Xuzuning Moderator, I tried the next page error OH. $res [$row [' type '] [] parentheses here, removing or making an error.
Ruled out the discovery is this error, $res = Array_values ($row); What is the reason for this?
Oh, it's a missing bracket.
$res [$row [' type '] [] = $row [' Typevalue '];
Oh, it's a missing bracket.
$res [$row [' type '] [] = $row [' Typevalue '];
Xuzuning Moderator, change to your latest this, or will page error. Hint is this sentence, error, do not know what is the reason $res = Array_values ($row);
Hint error is warning:array_values () expects parameter 1 to is array, boolean given in
This line is pointed to $res = Array_values ($row);
It's my fault!
$res = Array_values ($res);
Oh, it's a missing bracket.
$res [$row [' type '] [] = $row [' Typevalue '];
-----------------------------------
Fix the xuzuning moderator, is $res = Array_values ($row); Here is the wrong, $row out of the array is not an error, has been changed, thank you for your ideas.
It's my fault!
$res = Array_values ($res);
It's done. (*^__^*) hehe ... Thank you