title: Stop user from signing up for an event two times
body: <p>First of all, I'm using <code>MYSQL</code> because the servers at my university have not updated their <code>servers</code> for `mySQLI'.</p>
  
  <p><img src="https://i.stack.imgur.com/uICDt.png" alt="Table"></p>
  
  <p>Above is the table, test is going to attend all events, but I don't want test to attend the event again.</p>
  
  <pre><code>if(isset($_REQUEST['register'])!=''){
  
  $user = $name;
  $eventTitle = $_REQUEST['select'];
  
  $result = mysql_query("SELECT Event FROM attend where Event != '$eventTitle'"); // run the query and assign the result to $result
  while($table = mysql_fetch_array($result)) { // go through each row that was returned in $result
  
          echo $table[0];
          if($table[0] == $eventTitle)
          {
              echo "dont add";
          }
          else
          {
              echo"add";
          }
  }
  
  /*$sql="INSERT INTO `assignment`.`attend` (`User`, `Event`) VALUES ('$user', '$eventTitle')";
  
  $res=mysql_query($sql);
  
   if($res)
   {
      Echo "Record successfully inserted";
      //header("location: myTickets.php");
   }
   Else
   {
      Echo "There is some problem in inserting record";
       //echo $name;
  
   }
  </code></pre>
  
  <p>I'm tried looping through the 'Event' row to see if the value in there equals the value selected. But since it's a while loop it will keep on looping.</p>
  
  <p>Pseudo code wise </p>
  
  <pre><code>if(the value selected is == the value in the table &amp;&amp; and the name is == to data in the User row then do not add, else add;
  </code></pre>