PHP mysqli bind_params错误

时间:2016-06-17 21:55:36

标签: php apache unity3d mysqli

我无法让这个php脚本与mysqli一起使用。我使用Apache服务器,PHP 5.5,mysqli。连接有效,我有其他语句正常工作(但不是绑定)。

// NOTE: servername, username, password defined but not shown

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    // database connection error
    echo '1';
    $conn->close();
    exit();
} 
$sqlQuery = "INSERT INTO 'fishingusers' SET 'deviceID' = ?, 'nickname' = ?,     'valid_on' = 'NOW()', 'valid_until' = 'null'";

echo ' '. $sqlQuery . '';

$deviceID = $conn->real_escape_string($_GET['deviceID']);
$nickname = $conn->real_escape_string($_GET['nickname']);

$stmt = $conn->prepare($sqlQuery);
$stmt->bind_param('ss', $deviceIDValue, $nicknameValue);

$deviceIDValue = $deviceID;
$nicknameValue = $nickname;

if($stmt->execute()) {
    // insert success
    echo '0';
}
else {
    // insert failed
    echo '3';
}

$conn->close();

我收到此错误:

  

致命错误:在 27

第27行是$stmt->bind_param()。对不起,我对PHP很新......这看起来很简单。

0 个答案:

没有答案