我在尝试在MySQL中输入数据时没有用引号引起问题。PHP - 在没有引号的情况下在MySQL中输入查询
下面是它如何出现在MySQL的截图
下面是INSERT INTO代码,将其放入数据库中,我需要它输入到MySQL没有它被证明是具有挑战性的报价...
<?php include('db_connect.inc');?>
<?php
$result = $conn->prepare("INSERT INTO dog_park.reviews (review_text, username, date, rating, item) VALUES (:review, :id, :date, :rating, :keyword)");
$result->bindParam(':review', $value1);
$result->bindParam(':id', $value2);
$result->bindParam(':date', $value3);
$result->bindParam(':rating', $value4);
$result->bindParam(':keyword', $value5);
$value1 = $_POST['review'];
$value2 = $_SESSION['id'];
$value3 = $date = date("Y-m-d");
$value4 = $_POST['rating'];
$value5 = $_SESSION['KEYWORD'];
$result->execute();
echo "Review entry Successful, you will now be redirected to the home page";
header("refresh:10; url=index.php");
?>
也许与$ _SESSION有关?
没有错,你的代码是如何表单请亲?提供请求的转储。问题出在那里.. – Gogol
这里的东西不合适。你应该在绑定参数之前定义'$ valueN'变量。还要在你的代码中添加'var_dump($ _ POST)',看看有什么要调用 –
从窗体开始并按照处理过程。这里没有什么会将引号添加到数据库中。也许当你存储会话值你concat引号? – chris85