내 mysql 데이터베이스의 내용을 검색 할 때 PHP 스크립트에서 따옴표가있는 이상한 문제가 있습니다. Google 크롬에서 다이아몬드 모양의 물음표로 대체되었습니다.데이터베이스의 인용 부호가 다이아몬드의 물음표로 표시됩니다.
내 MySQL 데이터베이스는 데이터 정렬로 설정 : utf8_general_ci 레코드를 아래로 당겨
스크립트의 일부입니다 다음과 같이
<?php
echo '<div class="testimonialswrapper">';
// Retrieve Page Content //
$testimonialssql = <<<SQL
SELECT *
FROM `testimonials`
ORDER BY id DESC
LIMIT 5
SQL;
if(!$resulttestimonials = $db->query($testimonialssql)){
die('There was an error running the query [' . $db->error . ']');
}
while($rowT = $resulttestimonials->fetch_assoc()){
if ($rowT['company'] == ''){$name = $rowT['name'];}else{$name = $rowT['name'].' - '.$rowT['company'];}
$from = $rowT['from'];
$message = $rowT['message'];
echo '<p class="testititle">'.$name.'</p>';
echo '<p class="testifrom">'.$from.'</p>';
echo '<p class="testimessage">'.$message.'</p>';
}
echo '</div>';
?>
이는 다음을 가지고 내의 index.php에 포함되어 있습니다 설정 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
나는 htmlenteties 및 stripslashes 및 다양한 다른 것들을 사용하여 시도했지만 여전히 동일한 문제가 있습니다.
필드 옆에는 utf8_general_ci라고 쓰여 있으며 텍스트는 일반 텍스트 사본이며 기존 웹 사이트에서 phpmyadmin에 붙여 넣습니다. –
링크 된 기사를 읽지 않았습니다. 연결 인코딩이 없습니다! * – deceze
고마워!, mysqli_set_charset ($ db, 'utf8'); –