Nie doprecyzowałem pytania, chodzi mi o to, że w bazie widnieje np takie coś:
kolumna: phys_info
zawartość:
{"Ciu0119u017car montau017cowy":"25 kg"}
i podczas wyświetlania za pomocą tego dokumentu:
<?php
if (!isset($_GET['product'])) {
header('Location: ../404.html');
exit();
}
$id = $_GET['product'];
$id = htmlentities($id, ENT_QUOTES, "utf-8");
require_once('../websub-admin/php/config.php');
$prod_data = array();
$first_info = array();
$base_info = array();
$product_info = array();
$tech_info = array();
$phys_info = array();
if ($result = $mysqli->query(sprintf("SELECT * FROM `ws_products` WHERE id_produktu='%s'",
mysqli_real_escape_string($mysqli, $id)))) {
if ($result -> num_rows < 1) {
header('Location: ../404.html');
exit();
} else {
// POBIERANIE DANYCH
$row = $result->fetch_assoc();
$prod_data['nazwa'] = $row['nazwa'];
$prod_data['cena'] = $row['cena'];
$prod_data['zdjecie'] = $row['zdjecie'];
$prod_data['producent'] = $row['producent'];
$prod_data['how_many'] = $row['how_many'];
$first_info = json_decode($row['first_info']);
$base_info = json_decode($row['base_info']);
$product_info = json_decode($row['product_info']);
$temp = json_decode($row['tech_info']);
foreach ($temp as $key => $value) {
$k = str_replace('{CELSIUS}', '℃', $key);
$v = str_replace('{CELSIUS}', '℃', $value);
$tech_info[$k] = $v;
}
$phys_info = json_decode($row['phys_info']);
}
} else {
header('Location: ../404.html');
exit();
}
$mysqli->close();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<link rel="stylesheet" href="../css/main.css" type="text/css">
<link rel="stylesheet" href="../css/margins.css" type="text/css">
<link rel="stylesheet" href="../css/inputs.css" type="text/css">
<link rel="stylesheet" href="sklep.css">
<title>
<?php echo $prod_data['nazwa']; ?>
</title>
</head>
<div class="row mt-4">
<div class="col-md-6">
<div class="co__product-spec_section">
<div>
<span class="color__black product__param-key">DANE FIZYCZNE</span>
</div>
</div>
</div>
<div class="col-md-6">
<?php
foreach($phys_info as $key => $value) {
echo '<div class="co__product-param">
<span class="product__param-text">' . $key . ': ' . $value . '</span>
</div>';
}
?>
</div>
</div>
}
?>
Zamiast "Ciężar montażowy" widnieje "Ciu0119u017car montau017cowy". Jak to naprawić?