title: Undefined function is working at second click (with an error)
body: <p>I'm trying to add someone when they get a friendshiprequest. I created a function to accept or decline that person. But when I klik on fe 'accept' he does nothing, the second time he executes the sql function en sets the friendshipstatus from 'pending' to 'accepted' BUT I always get the following error:</p>
  
  <pre><code>Fatal error: Call to undefined function AcceptFriendRequest() in C:\wamp\www\Stimulus\friendrequests.php on line 82
  </code></pre>
  
  <p>SQL</p>
  
  <pre><code>UPDATE friendship SET friendship_status = 'Accepted' WHERE friendship_id ='101'
  </code></pre>
  
  <p>FUNCTION (in the class friendship)</p>
  
  <pre><code>public function AcceptFriendRequest($requestnumber){
          $db = new Db();
          $select = "UPDATE friendship SET friendship_status = 'Accepted' WHERE friendship_id ='" . $requestnumber . "'";  
      echo $select;
          $result = $db-&gt;conn-&gt;query($select);
          return $result;}
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>$user = new User();
  $friendship = new Friendship();
  $user_id = $_GET['user_id'];
  
  $email = $_SESSION["email"];
  $numberoffriendrequests = $friendship-&gt;GetTotalOfFriendRequests($user_id);
  $friendrequests=$friendship-&gt;GetAllFriendRequests($email);
  
      if (isset($_POST["Accept"])) {
      try {
  
  
          $requestnumber = mysql_real_escape_string($_POST['acceptID']);
          $friendship -&gt; AcceptFriendRequest($requestnumber);
          $feedback = "Awesome, You just added a friend!";
  
  
      } catch(Exception $e) {
          $feedback = $e -&gt; getMessage();
  
      }
  }
  
      if (isset($_POST["Decline"])) {
      try {
  
  
          $requestnumber = mysql_real_escape_string($_POST['declineID']);
          $friendship -&gt; DeleteFriendRequest($requestnumber);
          $feedback = "You just deleted a friend!";
  
  
      } catch(Exception $e) {
          $feedback = $e -&gt; getMessage();
  
      }
  }
  </code></pre>
  
  <p>MY PRINT OUT, my error has to be on this line:  <code>$accepted = AcceptFriendRequest($_POST['acceptid']);</code> </p>
  
  <pre><code> &lt;?php
      foreach ($friendrequests as $request) {
      echo "
          &lt;div&gt;&lt;p&gt;
              &lt;a href='profile.php?user_id=".$request['friendship_applicant_id'] . "'&gt;
                  &lt;img src='uploads/" . $request['friendship_applicant_avatar']  . " " . " ' alt='' /&gt;" . $request['friendship_applicant_surname'] . $request['friendship_id'] . " " . $request['friendship_applicant_name'] . "
              &lt;/a&gt; has send you a friend request" . "
  
              &lt;form action='" . $_SERVER['REQUEST_URI'] . "' method='post'&gt;
                  &lt;button type='submit' name='Accept'&gt;Accept&lt;/button&gt;
                  &lt;button type='submit' name='Decline'&gt;Decline&lt;/button&gt;
                  &lt;input type='hidden' name='acceptID' value='".$request['friendship_id']."' /&gt;
                  &lt;input type='hidden' name='declineID' value='".$request['friendship_id']."' /&gt;
              &lt;/form&gt;
          &lt;/p&gt;&lt;/div&gt;";   
      }//foreach
  
      if (isset($_POST['Accept'])){
          $accepted = AcceptFriendRequest($_POST['acceptid']);
  
          //echo $accepted;
      }
  
      if (isset($_POST['Decline'])){
            $decline = DeclineFriendRequest($_POST['declineid']);
      }
  </code></pre>