title: PHP Call to undefined function newuserid()
body: <p>I tried to put data from a form into a database. But I get a parse error saying that it cant find the function newuserid(). That function is ment to get latest userid in the database and than do +1 for a new user.</p>
  
  <p>Why is this not working? I can't seem to find anything about this on the internet.</p>
  
  <p>Here is a code snippet:</p>
  
  <pre><code>/**
          * newuserid - Creates a userid for every user, to link up to other services
          */
         function newuserid() {
             //Get latest userid
             $q = "SELECT userid FROM blog_users ORDER BY userid DESC LIMIT 1";
             $latest_userid = mysqli_query($this-&gt;connection, $q);
  
              $userid = $latest_userid + 1;   
            return $userid;
         }
  
         /**
          * addNewUser - Inserts the given (username, password, email)
          */
         function addNewUser($userdata){
              //Account
               $username = $userdata['username'];
               $password = $userdata['password'];
  
              //Personal Information
               $first_name = $userdata['first_name'];
               $last_name = $userdata['last_name'];
               $bdate = $userdata['bdate'];
  
              //Address  
                $address = $userdata['address'];
                $street_number = $userdata['street_number'];
                $city = $userdata['city'];
                $postal_code = $userdata['postalcode'];
  
              //Phone &amp; Email
                $email = $userdata['email'];
                $phone = $userdata['phone'];
  
           $userid = newuserid();
  
            $q = "INSERT INTO ".TBL_USERS." VALUES ('$username', '$password', '$userid', '$first_name', '$last_name', '$bdate', '$address', '$street_number', '$city', '$postal_code', '$email', '$phone')";
            return mysqli_query($this-&gt;connection, $q);
         }
  </code></pre>
  
  <p>Does someone know how to fix this, or recode a piece? Sorry, but i don't know alot about PHP, so I might use the wrong therms for some things.</p>
  
  <p>Please help me find the problem.</p>