Please take a look and teach me this newbie.
大浪淘金
大浪淘金 2017-07-22 15:08:00
0
4
1122

QQ截图20170722144814.png

I now have a table like this. The numbers in it are ages, which are read from the database. The following is the php code

QQ截图20170722145017.png

The effect I require now is to divide the colors according to the zodiac (for example: 01, 13, 25, 37, 49 is a chicken, just write chicken below the age, the background color is red. 02, 14, 26, 38 If you are a monkey, just write monkey below the age, the background color is blue, and so on...), the following is the rendering I made with PS

QQ截图20170722150337.png

Is there any master who can help me? I just learned PHP and I still don’t understand the basics of PHP. I hope the master can give me some advice. Thank you very much.


大浪淘金
大浪淘金

reply all (4)
立伟

Write 12 styles, such as hou ji or 1 2, etc. Set 12 zodiac signs, such as hou ji or 1 2, etc. Just set the style directly when looping

    辕天
    ".$no."
    "; break; case 2: echo "
    ".$no."
    "; break; case 3: echo "
    ".$no."
    "; break; case 4: echo "
    ".$no."
    "; break; case 5: echo "
    ".$no."
    "; break; case 6: echo "
    ".$no."
    "; break; case 7: echo "
    ".$no."
    "; break; case 8: echo "
    ".$no."
    "; break; case 9: echo "
    ".$no."
    "; break; case 10: echo "
    ".$no."
    "; break; case 11: echo "
    ".$no."
    "; break; case 0: echo "
    ".$no."
    "; break; default: echo "
    ".$no."读取数据出错!
    "; break; } } ?>
    NumberNo.1No.2No.3No.4No.5No.5No.7操 作
    Num1 修改  删除
    Num2 修改  删除
    Num3 修改  删除
    Num4 修改  删除
    Num5 修改  删除
    Num6 修改  删除
    Num7 修改  删除


      辕天

      Set twelve colors, and let each color correspond to a number (and zodiac sign) from 1-12. The test data is randomly generated from 1 to 49, and there may be duplicates.20170701.png
      A method num($no); $no is to obtain data.
      20170702.png

      For the convenience of testing, all data are randomly generated numbers from 1 to 49.

      20170703.png

      • reply The idea is roughly like this. If it is specific, it can be further optimized. It is best that the zodiac sign corresponding to the parameters in the method can be customized.
        辕天 author 2017-07-24 23:06:08
      ringa_lee

      You have to find the pattern. The difference between each number is 12. The chicken sign starts from 1 and adds 12, while the monkey sign starts from 2 and adds 12.

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!