<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2900.2802" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=265014512-14052006>Hi!</SPAN></FONT></FONT></DIV>
<DIV><FONT><SPAN class=265014512-14052006></SPAN><FONT face=Arial><FONT size=2>I
want to assign different colors to European countries based on data in a MySql
database. In this example, if the SCORE_TAX number is less than 10, the country
should appear yellow, if not it should appear blue. The database numbers are:
France - 12, Germany - 3, UK - 9. So France should be blue, and Germany
and the UK should be yellow. In fact, France is yellow while Germany and the UK
are white, the color assigned by the mapfile.<SPAN class=265014512-14052006>
</SPAN></FONT></FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>I've tried other variations on the code with no
luck. Any suggestions would be greatly appreciated.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>Thanks.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>bagehot</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>======================================<BR>Here's
the relevant code:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>$myquery = "SELECT * FROM scores";<BR>$myresult =
mysql_query($myquery);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>for ($i = 0; $i < 3; $i++) </FONT></DIV>
<DIV><FONT face=Arial size=2>{<BR> $this_layer =
$map->getLayerByName('Europe');<BR> $class =
$this_layer-> getClass($i);<BR> $style =
$class->getStyle(0);<BR> <BR> while
($myrow =
mysql_fetch_array($myresult))<BR> {<BR> if
($myrow['SCORE_TAX'] < 10)<BR> <SPAN
class=265014512-14052006>
</SPAN>{<BR> //yellow<BR> $int_red
= 255;<BR> $int_green =
255;<BR> $int_blue =
0; <BR> <SPAN
class=265014512-14052006>
</SPAN>}<BR> else <BR> <SPAN
class=265014512-14052006> </SPAN> {<BR> //blue<BR> $int_red
= 0;<BR> $int_green =
0;<BR> $int_blue =
255; <BR> <SPAN
class=265014512-14052006>
</SPAN>}<BR> <BR> $style->color->setRGB($int_red,$int_green,$int_blue);<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>=======================================<BR>The
relevant mapfile data is:</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>LAYER<BR> NAME
"Europe"<BR> TYPE POLYGON<BR> STATUS
ON<BR> DATA "europe1"<BR> <BR> CLASS<BR>
EXPRESSION ('[FIRST_FIPS]' eq 'FR')<BR> NAME
"France"<BR>
STYLE<BR>
COLOR 255 255 255<BR> END<BR>
END<BR> <BR> CLASS<BR> EXPRESSION
('[FIRST_FIPS]' eq 'GM')<BR> NAME
"Germany"<BR>
STYLE<BR>
COLOR 255 255 255<BR>
END<BR> END<BR> CLASS<BR>
EXPRESSION ('[FIRST_FIPS]' eq 'UK')<BR> NAME
"UK"<BR> STYLE<BR>
COLOR 255 255 255<BR>
END<BR>
END<BR>======================================</FONT></DIV></BODY></HTML>