Jump to content

Poopfeast

New Members
  • Posts

    2
  • Joined

  • Last visited

Poopfeast's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, as I'm hosting a local LAN I need to create a map of all the reserved and possible seats according to database information. I currently have all reserved seat information stored in an array like this: Array ( [0] => A2 [1] => D7 [2] => C10 [3] => [4] => [5] => [6] => [7] => F9 [8] => [9] => [10] => F1 [11] => F8 [12] => [13] => C8 [14] => [15] => [16] => [17] => F10 [18] => F4 [19] => F2 [20] => [21] => [22] => [23] => F5 [24] => F3 [25] => [26] => [27] => F7 [28] => [29] => D6 [30] => [31] => [32] => [33] => [34] => [35] => [36] => [37] => [38] => D4 Here's the table code for ($i = 1; $i <= 10; $i++) { if (array_key_exists('A'.$i, $array)) { $color = 'red'; } else ($color = 'green'); echo "<table border='1' width=200 height=40>"; echo "<tr>"; echo "<td bgcolor=".$color.">A" . $i . "</td>"; echo "<td bgcolor=".$color.">B" . $i . "</td>"; echo "<td bgcolor=".$color.">C" . $i . "</td>"; echo "<td bgcolor=".$color.">D" . $i . "</td>"; echo "<td bgcolor=".$color.">E" . $i . "</td>"; echo "<td bgcolor=".$color.">F" . $i . "</td>"; echo "</tr>"; echo "</table>"; } Which prints a table with A1 to A10 and B1 to B10 etc. Now the problem is that I don't know how to check each seat if they're already taken(in the array) and make it so that it returns red(seat taken) for each individual cell. I was hoping someone could help me with this, it'd be a huge help! Thanks for reading this.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.