-3

I keep getting this error whenever I try to fill out the form on my PHP signup form

mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement

Below is a snippet of the troublesome line

 $sql = "INSERT INTO users (username, email, password, token, refcode, referred, walletbalance, phone, address, country ) VALUES ('$username','$email','$password','$token','$refcode','$reffered','$walletbalance','$phone','$address','$country')";
     
     
     
    if($stmt = mysqli_prepare($link, $sql)){
        // Bind variables to the prepared statement as parameters
      mysqli_stmt_bind_param($stmt,"ssssssssss", $param_username, $param_email, $param_password, $param_token, $param_refcode, $param_referred, $param_bonus, $param_phone, $param_address, $param_country );
        
        // Set parameters
        $param_username = $username;
        $param_email = $email;
        $param_password = $password;
         $param_token = $token;
        $param_refcode = $refcode;
        $param_referred = $referred;
        $param_bonus = $bonus;
        $param_phone  = $phone;
        $param_address = $address;
        $param_country = $country;
        
Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
  • 1
    Welcome to Stack Overflow! Relevant code and error messages need to be included in your question *as text*, not as pictures of text. Just linking to screen shots makes it more difficult for people to help you. To learn more about this community and how we can help you, please start with the [tour] and read [ask] and its linked resources. – David May 24 '22 at 14:48
  • 1
    I encourage you to Google the error message. You will find possible solutions to your problem on Stack Overflow. There's no need to ask a new questions about this. – Dharman May 24 '22 at 14:51
  • There are literally no parameters in your query; you've directly inserted the variables into `$sql`. The whole point of prepared statements is that you don't put variables in the query, using the parameter `?` instead. This should be explained in any of thousands of examples on this site and others. – miken32 May 25 '22 at 17:41
  • I voted to reopen this question as the original close reason is no longer valid, now that the code has been provided. However if it gets reopened again, it should be closed as a typo or possibly duplicate. – miken32 May 25 '22 at 17:43

0 Answers0