[eluser]murphy2006[/eluser]
Hello!
I am a big problem. I am building small clone of the famous "million dollar homepage".
I need to generate a grid (40x60 squares) and then let people buy one or more of the squares. As I am generating the grid I need to populate the cells that are occupied and give it the color that the user selected.
The coordinates (row,cell) are saved into the database like this:
Code:
18,27 18,28 19,27 19,28
I have managed to generate the grid and populate the correct cells but I cannot color them.
Code:
include 'connect.php';
$result = mysql_query("SELECT cus_pixels FROM customers");
while($row = mysql_fetch_array($result)) {
$string .= $row['cus_pixels']." ";
}
$pixels = explode(' ', $string);
$a = 0;
while ($a <= 40) {
echo "<tr>";
$b = 0;
while ($b <= 60) {
if (in_array($a.','.$b, $pixels)) {
echo '<td class="occupied"></td>';
} else {
echo '<td class="pixel"></td>';
}
$b += 1;
}
echo "</tr>";
$a += 1;
}
Please help me fix this or perhaps suggest a better approch.