I\'ve got the code below to pull hex values from a database and create an image of that colour. There\'s over a thousand values, so it\'s looping to create an image for them all
$x = 0; is executed in each iteration of the while loop. You need to move the initialization in front the loop.
$x = 0;