= 0) { $chartData .= $simpleEncoding[round($simpleLength * $currentValue / $maxValue)]; } else { $chartData .= ‘_’; } } return $chartData; } $conexion = mysql_connect("localhost", "USUARIO", "PASSWORD"); mysql_select_db("rf_21_innodb", $conexion); $query = "SELECT MAX(Population/SurfaceArea) as max_pop from country"; $result = mysql_query($query, $conexion) or die(mysql_error()); $max = mysql_fetch_assoc($result); $max = $max['max_pop']; $max = 100; $query = "SELECT (Population/SurfaceArea) as Population, Code2 from country WHERE Population > 0 order by Population DESC"; $result = mysql_query($query, $conexion) or die(mysql_error()); $paises = ""; $data = array(); while ($row = mysql_fetch_assoc($result)) { $value = ($row['Population']/$max)*100; if($value > $max) $value = $max; $data[] = $value; $paises .= $row['Code2']; } $data = simpleEncode($data); ?>