PDO - SQLSTATE [HY093]:参数号无效:未定义参数

时间:2015-11-30 05:53:14

标签: php pdo

我在网站上使用了具有完全相同配置的多个表单,但我特别面临此表单的问题。

源代码:

<?php

if (!$_POST['assessment-occupation'] || !$_POST['assessment-highest-qualification'] || !$_POST['assessment-experience']) {
    echo "<p>Please supply all of the data!</p>";
    exit;
} else {
    require('db-connection.php');
    //require('file-upload-script.php');
    try {  
        session_start();

        $stmt = $conn->prepare("UPDATE visa SET job_title= :assessment-occupation, Qualifications= :assessment-highest-qualification, experience= :assessment-experience, comments= :assessment-comments WHERE id= :id");

        // escape variables for security
        $stmt->bindParam(':assessment-occupation', $_POST['assessment-occupation']);
        $stmt->bindParam(':assessment-highest-qualification', $_POST['assessment-highest-qualification']);
        $stmt->bindParam(':assessment-experience', $_POST['assessment-experience']);
        //$stmt->bindParam(':file_upload', $target_file);
        $stmt->bindParam(':assessment-comments', $_POST['assessment-comments']);
        $stmt->bindParam(':id', $_SESSION["regId"]);

        $stmt->execute();

    } catch (PDOException $e) {
        echo $e->getMessage();
    }
}

0 个答案:

没有答案