数据未与PrepareStatement绑定

时间:2017-02-24 08:04:04

标签: php mysql mysqli

这是我的程序示例:

$mysqli = new mysqli($db_host, $db_username, $db_password, $db_name);
if ($mysqli -> connect_error) {
    die('Error : ('. $mysqli->connect_errno .') '. $mysqli->connect_error);
}

if ($stmt = $mysqli -> prepare("SELECT c_id, c_name, c_pic,o_name, c_location, c_address, PIN, c_phone, c_email, c_category, c_message FROM client_detail WHERE c_category = ? AND active='yes'")) {
    $stmt -> bind_param('s',$Data);
    $stmt -> execute();
    $stmt -> bind_result($c_id,$c_name,$c_pic,$o_name,$c_location,$c_address,$PIN,$c_phone,$c_email,$c_category,$c_message);
}

当我通过?作为文章时会出现问题,而如果我传递具体值或变量,则查询正在运行。

如果我跳过where程序也运行,为什么数据没有绑定到?

0 个答案:

没有答案