I am inserting data into a database using PDO::prepare, and double quotes (example "pickled vegetables" are properly added to database when form is accessed from a computer. However, when input is from iPhone Safari, the insert is cut off right before the quotes and not implemented.
我正在使用PDO :: prepare将数据插入数据库,并且在从计算机访问表单时将双引号(例如“腌制蔬菜”)正确添加到数据库中。但是,当从iPhone Safari输入时,插入被切断在引号之前并没有实现。
<?php
include 'connect.php';
$location = $_POST['location'];
$item = $_POST['item'];
$review = $_POST['review'];
$type = $_POST['type'];
//Create our INSERT SQL query.
if($_POST['location']) {
$sql = "INSERT INTO reviews (location, item, review, type) VALUES
(:location, :item, :review, :type)";
//Prepare our statement.
$statement = $pdo->prepare($sql);
//Bind our values to our parameters (we called them :make and :model).
$statement->bindValue(':location', $location);
$statement->bindValue(':item', $item);
$statement->bindValue(':review', $review);
$statement->bindValue(':type', $type);
//Execute the statement and insert our values.
$statement->execute();
}
?>
Any input would be greatly appreciated!
任何投入将不胜感激!
1 个解决方案
#1
0
Solution: iOS 11 has a "smart punctuation" feature that converts quotes to curly quotes, double hyphens to dashes, etc. Apparently, the PDO::prepare statement has not yet accounted for these smart characters, and they must be manually isolated and replaced.
解决方案:iOS 11具有“智能标点符号”功能,可将引号转换为弯引号,双连字符转换为破折号等。显然,PDO :: prepare语句尚未考虑这些智能字符,必须手动隔离并替换它们。
#1
0
Solution: iOS 11 has a "smart punctuation" feature that converts quotes to curly quotes, double hyphens to dashes, etc. Apparently, the PDO::prepare statement has not yet accounted for these smart characters, and they must be manually isolated and replaced.
解决方案:iOS 11具有“智能标点符号”功能,可将引号转换为弯引号,双连字符转换为破折号等。显然,PDO :: prepare语句尚未考虑这些智能字符,必须手动隔离并替换它们。