0

my sign up page keeps outputting the error Fatal error: Uncaught Error: Call to undefined method mysqli_stmt::mysqli_stmt_bind_param() in /home/cryptosa/public_html/users/form/signup.php:140 Stack trace: #0 {main} thrown in /home/cryptosa/public_html/users/form/signup.php on line 140

i have tried to the best of my ability to replace the deprecated code, below is a snippet of line 140

    $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
       $stmt->mysqli_stmt_bind_param("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;
        
        
        
Shadow
  • 33,525
  • 10
  • 51
  • 64
  • 1
    If you use the object-oriented calling style, it's just `$stmt->bind_param(...)`. See code examples in the documentation: https://www.php.net/manual/en/mysqli-stmt.bind-param.php – Bill Karwin May 24 '22 at 23:35
  • 2
    Mysqli can be confusing because it has both procedural and object-oriented APIs. The problem here is that you're mixing up the function/method names and/or API style between the two. If you're not too deep into your implementation I would suggest switching to PDO as it has a single, object-oriented API and is generally easier to work with. https://phptherightway.com/#pdo_extension – Sammitch May 25 '22 at 00:03
  • 1
    I agree with @Sammitch, I prefer to use PDO over mysqli. – Bill Karwin May 25 '22 at 00:18

0 Answers0