title: PHP WHILE LOOP until it someone insert to the game
body: <p>im using YII FRAMEWORK right now, im kinda developing this game USING PHP.</p>
  
  <p>i like to know what is the right codes for the problem i like to solve..</p>
  
  <p>i try to use if-else thou i think while loop would be the answer.</p>
  
  <p>I have this database name <code>gameWaiting</code> and i have this <code>button</code> on my game name <code>createGame</code></p>
  
  <p>so when the player click the button <code>createGame</code> it will now insert to the database.</p>
  
  <p>While it was in the database named <code>gameWaiting</code> meaning this player was waiting for another player.</p>
  
  <p>then when another player click the createGame this player will automatically load the game.</p>
  
  <p>But how can i loop my codes to wait for another player...</p>
  
  <p>is this the correct code?</p>
  
  <pre><code>$game = mysql_query( "SELECT * FROM game " );
  while( $game_is_not_empty_loop &gt; empty($game) ){
    // CODES HERE
  }
  </code></pre>
  
  <p>I try to use <code>if else</code> but it stop waiting for the game.
  I also try to put sleep(30) so it will wait for another player but i guess that would not be useful...</p>
  
  <p>help me please. </p>