Incognition

Untitled

Aug 15th, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. //GENERERA PLATSER
  2. $result = $con->query("SELECT `seat` FROM `user_book`");
  3.    
  4. $seatsTaken = array();
  5.  
  6. if( mysql_num_rows( $result ) > 0 )
  7. {
  8.     while ( $row = mysql_fetch_assoc( $result ) )
  9.     {
  10.         $seatsTaken[] = $row['seat'];
  11.     }
  12. }
  13.  
  14. echo "<select name=\"seats\">";
  15.  
  16. for ($i = 1; $i <= 124; $i++)
  17. {
  18.     if( in_array($i, $seatsTaken ) )
  19.         continue;
  20.    
  21.     echo "<option value=\"$i\">$i</option>";
  22. }  
  23.  
  24. echo "</select>";
Advertisement
Add Comment
Please, Sign In to add comment