Ask the tp experts to see why the css on the template cannot be changed through the status value in the database. Is there any good way? -Php Tutorial

Source: Internet
Author: User
Ask the tp experts to see why the css on the template cannot be changed through the status value in the database. Is there any good way? Indicates that the font and icon are displayed in red during review, and the font and icon are displayed in black after deletion. The attached code is as follows:
If ($ info = M ("handmebuyinfo") {$ row = $ info-> where ("username = '$ username'")-> select (); // dump ($ row [1] [status]); $ this-> assign ('info', 'purchase '); if ($ row [0] [status] = 'under review ') {$ this-> assign (color,' # DC143C ');} if ($ row [0] [status] = 'delete') {$ this-> assign (color, 'black ');}}

{$vo.status}


Reply to discussion (solution)

From the displayed three rows, we can infer that $ row is an array of 3 rows and n columns.
Therefore, color should also be an array of three elements.

From the displayed three rows, we can infer that $ row is an array of 3 rows and n columns.
Therefore, color should also be an array of three elements.

Yes. $ row [0] [status] only outputs the status value of the first record. do you want to output color cyclically?

The logic of your code is that if the first piece of data is under review, all states are set to red; otherwise, all are set to black.

{$ Vo. status}

{$ Vo. status}

This method is good .. Thank you.

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.