出于某种原因,bind_param()
说它是在非对象上调用的,这是我的脚本:
$con = new mysqli("localhost", "root", "", "lesea");
以下是调用查询的位置:
var_dump($_POST['title']);
var_dump($_POST['description']);
var_dump($__final_route);
$stmt = $con->prepare("INSERT INTO post(title, content, image) VALUES(?, ?, ?)");
$stmt->bind_param('sss', $_POST['title'], $_POST['description'], $__final_route);
if($stmt->execute()){
echo "Post uploaded successfully!";
} else{
echo "Post not uploaded due to an error, please try again.";
}
var_dump()
为bind_param()
方法中保存的每个变量提供字符串,因此我不知道发生了什么。菜鸟错了吗?我做了任何后端开发已经有一段时间了。任何帮助将非常感激。