Ask one more question about the PHP array format,

Source: Internet
Author: User
Ask a question about PHP array format again, please.
Thanks for the problem with the previous array xuzuning help me answer, I want to ask another, if I put the table type value in the array this can also do?





The following array is implemented through the table above



Array (

[classname] = = Array (
[0]=>
[1]=> Wedding Service
[2]=> Machinery and equipment
[3]=> Hospital Medical
[4]=> Lighting Fixtures
[5]=> Education and Training
[6]=> Chemical Coating
[7]=> Beauty and Fitness
[8]=> Gourmet Dining
[9]=> Car Service
)
[Layout] = = Array (
[0]=>
[1]=> General
[2]=> two columns
[3]=> three columns
[4]=> Grid
)
)


------to solve the idea----------------------
According to my writing, $res is the format you want now.
Because your post wants an array of subscripts, there will be
$res = Array_values ($res);
------to solve the idea----------------------
while ($row = Mysql_fetch_assoc ($rs)) {
if ($row [' typeid '] = = 0) $row [' typevalue '] = ';
$res [$row [' type ']][] = $row [' Typevalue '];
}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.