dongliang9576
2018-01-05 15:20
浏览 37
已采纳

SQLSTATE [HY093]:参数号无效:参数未定义问题[重复]

I am very unsure at why I am getting such an error with my code

try {
$stmt = $connection->prepare("INSERT INTO table (path, title, era, information)
            VALUES (:path, :title, :era, :information)");
$stmt->bindParam(':path', $fname);
$stmt->bindParam(':title', $Name);
$stmt->bindParam(':era', $Era);
$stmt->bindParam(':descrip', $Description);

// insert row
$stmt->execute();
}
catch(PDOException $e) {
echo $e->getMessage();
}
echo "Upload Successful";
}

I have tried so many different options and I just cant fix the error

$fname=$_FILES["userfile"]["name"];
$Name =$_POST["name"];
$Era =$_POST["era"];
$Description =$_POST["info"];

these are the variables I used if that helps in solving my issue

</div>
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • duanqian2368 2018-01-05 15:22
    已采纳

    You define the values ':path, :title, :era, :information' in your prepare statement but try to set a value for the field ':descrip' later on. Because this field is not defined in the prepare call you get that error.

    Use ':information' instead of ':descrip'.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题