title: change color of specific div dynamically
body: <p>i would like to change the <code>divs</code> color accordingly, dynamically if possible this is what i have so far:</p>
  <p><strong>My database: shape</strong></p>
  <pre><code>id is_success
  id1      0
  id2      1
  id3      0
  id4      1
  
  &lt;div class=&quot;container&quot; style=&quot;background: black; width: 500px; height: 500px;&quot;&gt;
      
      &lt;div style =&quot;id=&quot;id1&quot; width: 35%;  height: 14%; margin:20%&quot;&gt; div1 &lt;/div&gt;
      &lt;div style =&quot;id=&quot;id1&quot; width: 35%;  height: 14%; margin:80%&quot;&gt; div2 &lt;/div&gt;
      &lt;div style =&quot;id=&quot;id1&quot; width: 35%;  height: 14%; margin:10%&quot;&gt; div3 &lt;/div&gt;
      &lt;div style =&quot;id=&quot;id1&quot; width: 35%;  height: 14%; margin:60%&quot;&gt; div4 &lt;/div&gt;
      
  &lt;/div&gt;
  
   &lt;?php
       $sql = &quot;SELECT * FROM shape &quot;;
         
         if ($result-&gt;num_rows &gt; 0)
          {
             while($row = $result-&gt;fetch_assoc())
             {
                $id = $row['id'];
                $is_success = $row['is_success'];
                if ($is_success == 1)
                {
                    //change the divs background color to green
                }else {
                      //change the divs background color to red
                }
             }
         }
     
     
  </code></pre>
  <p>this is what the end result should look like this:</p>
  <p><a href="https://i.stack.imgur.com/J0rxK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/J0rxK.png" alt="enter image description here" /></a></p>
  <p>so when ever a value changes from the database the background color of the div should be set is this possible
  <strong>Updated</strong>: Please Note that Each div are located at different positions on the html page</p>