Answer the question
In order to leave comments, you need to log in
How to implement the output from the database to the table?
There is a database table:
And an html table:
How to make the records that are in the database table highlighted in green according to the number in the html table: (for example, tm-200 is number 200) and if there is no such number, they remain red!
Answer the question
In order to leave comments, you need to log in
1. Collect an array of numbers, the coincidence with which gives green color (for example, we selected all the values of the column, using explode we split the string by the _ symbol. If in the end we got 2 elements, then the second one is the desired number, we wrote it into the green array)
2. When filling out the table, look for a number in the array of green numbers.
Alternatively, you can enumerate all the cells of the table after filling the table, for example, using JS. We ran through td, took the value, made parseInt, searched in the array, put down the corresponding color.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question