title: Adding Users to an Event via SQL and PHP
body: <p>I have a webpage that allows user to register their attendance to an event. This works fine however I am trying to add that a user cannot register for the same event more than once. So I am using a select statement to check if a record exists that matches the users input email and desired event. If a record exists it returns a value of 1 or greater and as a result informs the user they are already registered. However my code is returning a value of 1 no matter what email or event is selected. Any help would be appreciated.</p>
  
  <pre><code> $sql2= "SELECT COUNT*
      FROM event_attendees
      WHERE event_name='$reg' AND user_email='$email'";
  $r=mysql_query($sql2,$conn)or die(mysql_error());
  if($r=1)
      {
          echo"Already Registered for this event";
          echo $r;
      }
  </code></pre>