<th>Color</th> <th>Name</th> </tr> </thead> <tbody> <tr> <td><a href="#"><span class="badge badge-success">Green</span></a></td> <td>Countries that are within the global standard</td> </tr> <tr> <td> <?php for ($i = 1; $i < 10; $i++) { $k = $i * 10; echo '<span class="badge badge-secondary" style="background-color:#' . PercToHex($k) . '"> </span></span>'; } ?> </td> <td>Countries that are not within the global standard</td> </tr> <tr> <td><a href="#"> <span class="badge badge-primary">Others</span></a></td> <td>Countries with no data</td> </tr> </tbody> </table> <?php } ?> </div>
$yr = substr($field, 1, 4); } } } ///------------- if (is_numeric($Yr) && $Yr != '') { $yr = $Yr; } if ($data0['heatmap'] == 0) { //$mC = $data0['meanCountry']; $sql1 = "SELECT AVG(Y{$yr}) as Y FROM " . $data0['indicator_tablesource'] . " WHERE `ISO_Code` != ''"; //echo $sql1 ; $result1 = mysql_query($sql1) or die(mysql_error()); $data1 = mysql_fetch_assoc($result1); $meanVal = $data1['Y']; $sql = str_replace('$yr', $yr, $data0['sqlstatement']); $sql = str_replace('$mC', $meanVal, $sql); //echo $sql; $result = mysql_query($sql) or die(mysql_error()); while ($data = mysql_fetch_array($result)) { $k[$data['ISO_Code']] = $data['colorcode']; } } else { $sql = "SELECT ISO_Code, Y{$yr} FROM " . $data0['indicator_tablesource'] . " WHERE ISO_Code != ''"; //echo $sql; $result = mysql_query($sql) or die(mysql_error()); while ($data = mysql_fetch_array($result)) { $k[$data['ISO_Code']] = "#" . PercToHex($data['Y' . $yr]); } } print json_encode($k);