Hi all
i have a database filled with map coords.
all the coords needed for the polygon a in a table cell called "prov_coords" the number of sides are in the cell called "prov_sides"
when i perform a select and try to put all the coords in an array, it somehow doesnt work.
in the coord cell all the coords are sperated by a comma.
for example: (top 3 coords of some provinces)
coords ------ sides
530,599,524,569,503,558,513,548,524,535,559,552,560,579,549,597 8
530,502,537,515,544,515,550,510,554,512,524,535,513,548,499,541,509,512 9
471,538,470,526,474,516,485,501,509,512,499,541 6
the code:
$image = imagecreate(600,600);
$black = ImageColorAllocate($image,0,0,0);
$map = mysql_query("SELECT * FROM provinces WHERE prov_sides > 0");
while ($row = mysql_fetch_array($map)) {
$coords = $row['prov_coords'];
$sides = $row['prov_sides'];
echo "the coords are ".$coords;
$provpoly = array($coords);
imagefilledpolygon($image, $provpoly, $sides, $black);
}
imagePNG($image);
imagedestroy($image);
the result:
the coords are 530,599,524,569,503,558,513,548,524,535,559,552,560,579,549,597
Warning: imagefilledpolygon() [function.imagefilledpolygon]: You must have at least 3 points in your array in c:\apache\apache\htdocs\legacy\index.php on line 39
the coords are 530,502,537,515,544,515,550,510,554,512,524,535,513,548,499,541,509,512
Warning: imagefilledpolygon() [function.imagefilledpolygon]: You must have at least 3 points in your array in c:\apache\apache\htdocs\legacy\index.php on line 39
the coords are 471,538,470,526,474,516,485,501,509,512,499,541
Warning: imagefilledpolygon() [function.imagefilledpolygon]: You must have at least 3 points in your array in c:\apache\apache\htdocs\legacy\index.php on line 39
what am i doing wrong?
thnx
Arjan