Sorry tsinka, there's a lot of GD in there, I don't think it would make it clearer.
Here's the sql;
$sql = "SELECT F1, F2, F3, F4, F5, F6, F7, F8, F9 FROM tblArrayNames WHERE NAME = '".$AName."'";
From here on in GD takes over and there's a bit of math.
$AName will have the '#' and '+' chars in it. I can't tell if the $sql result is empty or what. I'd better find out, its just a pain, I can't explain. I can't do echo's to the browser window or it will knacker the image. Its like working in the dark. Its hard.