Mysql character set problem


#1

Hello!

For some reason when I output data some characters are not shown properly. I have tried everything I know but I just can't get it work. Other outputs in my site are working fine.

Here is the code:

<?php
$connect = mysqli_connect("localhost", "root", "", "tartalomkezelo");
$output = '';
if(isset($_POST["query"]))
{
 $search = mysqli_real_escape_string($connect, $_POST["query"]);
 $query = "SELECT * FROM products WHERE title LIKE '%$search%' AND deleted = 0 LIMIT 10";
}

$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) > 0)
{
 $output .= '
<div class="index-instant-search-background">
<table class="table table-striped">
<tr>
 <th>Termék</th>
 <th>Kiszerelés</th>
</tr>
 ';
 while($row = mysqli_fetch_array($result))
 {
  $output .= '
   <tr>
    <td><a class="index-instant-search-link" href="products.php?id='.$row["id"].'">'.$row["title"].'</td>
    <td>'.$row["weight"].' '.$row["weight_opt"].'</a></td>
   </tr>
  ';
 }
 echo $output;
}
else
{
 echo 'Nincs találat!';
}

?>
</table>
</div>

#2

Can you perhaps give an example of which part of the output is incorrect, and how it is incorrect? Do you specify a character set anywhere, either in the database connection code or in your HTML output? Is the data stored correctly in the database, if indeed the problem lies in data you have retrieved through your query?


closed #3

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.