[php] DB에서 받은 정보 테이블로 출력하는데 한글이 안나와요ㅠㅠ
조회수 1738회
영어는 잘 나오는데 한글이 ???로 나오는 이유가 뭘까요ㅠㅠ mysqli_set_charset($con, "utf8");을 써봐도 안되고 html에 meta charset="utf-8"을 써도 안되요..
php 소스
<?php
if (isset($_POST['search']))
{ $valueToSearch = $_POST['valueToSearch'];
$query = "SELECT * FROM `chicken` WHERE CONCAT(`restid`, `rest`, `ph`, `adress`, `rate`) LIKE '%".$valueToSearch."%'";
$search_result = filterTable($query);
}else {
$query = "select * from chicken";
$search_result = filterTable($query);
}function filterTable($query)
{ $connect = mysqli_connect("localhost","root","pw","db");
$filter_Result = mysqli_query($connect, $query);
return $filter_Result;
}?>
<!DOCTYPE html>
<html>
<head>
<style>
table,tr,th,td
{
border: 1px solid black;
}
</style>
</head>
<body>
<form action="chicken.php" method="post">
<input type="text" name="valueToSearch" placeholder="검색어를 입력하세요!"><br><br>
<input type="submit" name="search" value="검색"> <br><br>
<table width = 80% border = 3 cellpadding = 10>
<tr>
<th>음식점id</th>
<th>음식점이름</th>
<th>전화번호</th>
<th>주소</th>
<th>평점</th>
</tr>
<?php mysqli_set_charset(mysqli_connect("localhost","root","gustn1228!","kbstar21_db"), "utf8");
while($row = mysqli_fetch_array($search_result)):
?>
<tr>
<td><?php echo $row['restid']; ?> </td>
<td><?php echo $row['rest']; ?> </td>
<td><?php echo $row['ph']; ?> </td>
<td><?php echo $row['adress']; ?> </td>
<td><?php echo $row['rate']; ?> </td>
</tr>
<?php endwhile; ?>
</table>
</form>
</body>
</html>
desc table
select * from table
댓글 입력