php – Problems with decode UTF8-ThrowExceptions

Exception or error:

I tried everything to solve the problem and still do not know, commas above the letters yes but the hooks above the letters no. please help, sample code. Everything works on the web, but when I add items I have a ->? But in the database I have hooks and commas as it should be.

     $connect = new PDO("mysql:host=****;dbname=******_eshop", "*****_eshop", "C3*****e");

      $query = "SELECT * FROM produkt_sklen_dary ORDER BY id DESC";
     header('Content-Type: text/html; charset=UTF-8');
     $statement = $connect->prepare($query);

      if($statement->execute())
     {
$result = $statement->fetchAll();
$output = '';
foreach($result as $row)
{

    $output .= '
    <div class="col-md-3" style="margin-top:12px;">  
        <div style="border:1px solid #333; background-color:#f1f1f1; border-radius:5px; padding:16px; height:auto;" align="center">
        <img src="fotky_sklendary/'.$row["fotka"].'" class="img-responsive" /><br />
            <h4 class="text-info">'.utf8_encode($row["jmeno"]).'</h4>
            <h4 class="text-danger">CZK '.$row["cena"] .'</h4>
            <div contenteditable="false" style="color:#595959">'.utf8_encode($row["popis"]).'</div>
            <input type="text" name="quantity" id="quantity' . $row["id"] .'" class="form-control" value="1" />
            <input type="hidden" name="hidden_name" id="name'.$row["id"].'" value="'.utf8_encode($row["jmeno"]).'" />
            <input type="hidden" name="hidden_price" id="price'.$row["id"].'" value="'.$row["cena"].'" />
            <input type="button" name="add_to_cart" id="'.$row["id"].'" style="margin-top:5px;" class="btn btn-success form-control add_to_cart" value="Přidat do košíku" />
        </div>
    </div>
    ';
}
echo $output;

Next using

  <script>  
   $(document).ready(function(){

load_product();

load_cart_data();

function load_product()
{
    $.ajax({
        url:"fetch_itemglassgifts.php",
        type:"POST",

        success:function(data)
        {
            $('#display_item').html(data);
        }
    });
}
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *