I entered into the database of colors. '$ rascvet [0] $ rascvet [1] $ rascvet [2]'
As a result, like this: "Brown Black Green" or "Black White", etc.
I deduce from DB a line, I compare and on the screen there is a picture of a coloring or a combination of coloring.
There are a lot of options. For example: var1-black; var2-white black; var3 black gray etc
Will it be correct if for each option there is a separate condition and its own picture?
Or is there some more rational way?
Now I use If elseif elseif ...
$row = mysql_fetch_assoc($result); do { if ($row['rascvet'] == "Коричневый Белый ") echo <img>1</img>'; elseif ($row['rascvet'] == "Белый ") echo <img>2</img>; elseif ($row['rascvet'] == "Черный Зеленый ") echo <img>3</img>; /*и так далее*/ }
$opts = ['белый' => "2.jpg", ...]and<img src="<?= $opts[$row['rascvet']]?>"/>- teran$rascvetvariable in the first sentence that it just wouldn't be: D - teran