无法通过php更新mysql中的行

5ssjco0h  于 2021-06-23  发布在  Mysql
关注(0)|答案(1)|浏览(258)

我试图更新表showtable中的一行
bugupdate通过使用下面的php代码,将bugid绑定到sql update语句来更新我想更新的行,但是它似乎不起作用,问题是出在我的sql语句中吗?

$id = $_GET['update'];
 $games = htmlentities($_POST['games']);
        $version = htmlentities($_POST['version']);
        $platform = htmlentities($_POST['platform']);
        $frequency = htmlentities($_POST['frequency']);
        $proposal = htmlentities($_POST['proposal']);
        $SQLstring2 = "UPDATE " .$TableName. " SET Game=?,Version=?,Platform=?,Frequency=?,Proposed solution=? WHERE BugID= " .$id;
        if ($stmt = mysqli_prepare($DBconnect, $SQLstring2)) {

            mysqli_stmt_bind_param($stmt,'sssss', $games, $version, $platform, $frequency, $proposal);
            $QueryResult2 = mysqli_stmt_execute($stmt);
            if ($QueryResult2 === FALSE) {
                echo "<p>Unable to execute the query.</p>"
                . "<p>Error code "
                . mysqli_errno($DBconnect)
                . ": "
                . mysqli_error($DBconnect)
                . "</p>";
            } else {
                echo "<h1> Thank you for your contribution";
            }
            mysqli_stmt_close($stmt);
        }

        mysqli_close($DBconnect);
des4xlb0

des4xlb01#

尝试重命名 Proposed solution 列到 Proposed_solution 并对sql查询进行如下调整:

$SQLstring2 = "UPDATE " .$TableName. " SET Game=?,Version=?, Platform=?, Frequency=?, Proposed_solution=? WHERE BugID= " .$id;

相关问题