mysqli准备的声明没有做任何事情

时间:2013-09-02 13:06:31

标签: php mysqli

准备好的陈述给我带来了麻烦。我可以从数据库中读取数据,但无法写入。这是我遇到麻烦的准备好的陈述。没有错误,但代码执行时没有任何反应。感谢。

 /*Prepared statement option 1*/

    $stmt = mysqli_prepare($con, "INSERT USERS (userEmail, userPassword, userFname, userLname) VALUES (?, ?, ?, ?)");

/*prepared statement option 2*/

    $query = "INSERT INTO users (userEmail, userPassword, userFname, userLname) VALUES (?, ?, ?, ?)";
    $stmt = mysqli_prepare($con, $query);

/ 绑定声明 /

    mysqli_stmt_bind_param($stmt, 'ssss', $userEmail, $userPassword1, $euserFname, $userLname); 

/* execute prepared statement */
    mysqli_stmt_execute($stmt); 

/* close statement and connection */
    mysqli_stmt_close($stmt); 

1 个答案:

答案 0 :(得分:0)

始终在连接到mysqli之前使用此行:

mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);