致命错误:未捕获的 PDOException:SQLSTATE [HY093]:无效的参数编号:参数未在中定义

问题描述 投票:0回答:0

我对编程和 pdo 还是新手。我已经探索了一些解决方案,但仍然找不到解决方案。真的需要帮助。我收到了这个错误。

致命错误:未捕获的 PDOException:SQLSTATE[HY093]:无效的参数编号:参数未在 /home/....(站点名/文件名)php:65 PDOStatement->execute() #1 {main} throw in / home/...(sitename/filename) 第 65 行

真的需要专家或任何有此问题经验的人或任何人都可以看到问题所在的帮助和解决方案建议。提前致谢。

type here
```[enter image description here](https://i.stack.imgur.com/oP1g9.jpg)

$sql ="UPDATE data SET img_kmz =:fileNameNew WHERE id = :form_id LIMIT 1";
                $stmt = $conn->prepare($sql);
                
                $stmt->bindParam(':id', $form_id, PDO::PARAM_STR);
                $stmt->bindParam(':img_kmz', $fileNameNew, PDO::PARAM_STR);
                
                //one sfor each parameter

// $stmt->bindParam(":file_name", $files->name, PDO::PARAM_STR); // $stmt->bindParam(":file_source", file_get_contents($files->tempName), PDO::PARAM_LOB, 0, PDO::SQLSRV_ENCODING_BINARY); $stmt->执行();

            //sql2 = "INSERT INTO data(img_kmz) VALUES (?) WHERE id = :form_id";
                echo $sql;
                
                //tmt = $conn->prepare($sql);
                //tmt->bind_param('s',$fileNameNew);   //one sfor each parameter
                //tmt->execute();
                
        //$stmt-> execute([$fileNameNew]);
                
                #move uploadedimage to 'uploads' folder
                move_uploaded_file($fileTmpName, $fileDestination);
                
                #Redirect to 'index.php'
                //header("Location: index.php");
php mysql pdo parameters upload
© www.soinside.com 2019 - 2024. All rights reserved.