V
V
Vladimir2018-02-08 20:22:21
PHP
Vladimir, 2018-02-08 20:22:21

How to implement the output from the database to the table?

There is a database table:
5a7c8640a0169121804011.jpeg
And an html table: 5a7c86c5c9cfe819528945.jpeg
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 answer(s)
O
OKyJIucT, 2018-02-08
@OKyJIucT

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 question

Ask a Question

731 491 924 answers to any question