INSERT INTO mysqli准备语句错误

时间:2016-06-30 03:11:42

标签: php mysql mysqli

所以我有这个查询给出了一个关于mysqli_bind_param()期望参数1为mysqli_stmt的错误,给定布尔值

这是查询

$query = "INSERT INTO `users` (`user_name`, `password`, `first_name`, `last_name`) VALUES (?, ?, ?, ?)";
$stmt = mysqli_prepare($conn, $query);
mysqli_stmt_bind_param($stmt, 'ssss', $user_name, $pass, $first_name, $last_name);
mysqli_stmt_execute($stmt);

这是我的连接代码:

<?php

$mysql_error = 'Could not connect';
$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_pass = '';
$mysql_db = 'users';

$conn = @mysqli_connect($mysql_host, $mysql_user,$mysql_pass,$mysql_db) or die($mysql_error); 


?>

编辑:

这是数据库名称:users 这是表名:user 这是列名: iduser_namepasswordfirst_namelast_name

0 个答案:

没有答案