开发者

mysqli insert query

开发者 https://www.devze.com 2022-12-30 16:45 出处:网络
i have this error: Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn\'t match number of bind variables in E:\\wamp\\www\\classes\\UserLog

i have this error:

Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables in E:\wamp\www\classes\UserLogin.php on line 31

and i dont know what it is :/

here is my code

function createUser($username, $password) {
$mysql = connect();
if($stmt = $mysql->prepare('INSERT INTO users (username, password, alder, hood, fornavn, efternavn, city, ip, level, email) VALUES (?,?,?,?,?,?,?,?,?,?)'))  {
  $stmt->bind_param($username,开发者_StackOverflow中文版$password, $alder, $hood, $fornavn, $efternavn, $city, $ip, $level, $email);
  $stmt->execute();
  $stmt->close();
} else {
  echo 'error: ' . $mysql->error;
}

then my user create the user they only need to type username and password, and later they can edit the profile and edit, email,alder,hood and like that :).


I believe your bind_param call should include a type specification string. In your case, perhaps something like this:

$stmt->bind_param('ssssssssis', $username,$password, $alder, $hood,
    $fornavn, $efternavn, $city, $ip, $level, $email);

although I'm guessing at your data types. See the mysqli_stmt::bind_param documentation page for more information.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号