So I don't know why but when I put my website up online from offline suddenly the website will not show any symbols and I'm not sure why. It worked fine offline. Really couldn't find any info on this never seen it before :(
<?php
header('Content-Type: text/html; charset=UTF-8');
echo <<<_END
<!DOCTYPE html>
<html>
<head>
<title>$title</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link href="bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="bootstrap/css/bootstrap-theme.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body>
_END;
and index.php
<?php
$title = 'Baz Building';
require_once 'header.php';
require_once 'nav.php';
?>
<div class="container">
<h1>Welcome to baz Build by Richard Hayward</h1><br><br>
<div class="col-8">
<h2 class="text-center">Houses</h2>
</div>
<div>
<ul class="list-group">
<?php
//Get connection details from file
require_once'mysqli-con.php';
//Create new connection
$conn = new mysqli($hn, $un, $pw, $db); //Create new object, MYSQLI connection
if ($conn->connect_error) die ($conn->connect_error); //Display error if failed to connect
// Create first query to get all house names for count
$query_names = $conn->query('SELECT name FROM house_names'); // Query all names data
$num_rows = $query_names->num_rows; // Get the number of rows for loop
//Start loop for output of each item
for($c = 0 ; $c < $num_rows ; ++$c){
//Query Join
$query_names->data_seek($c);
$name = $query_names->fetch_array(MYSQLI_NUM);
$query = "SELECT house_names.id, house_names.name, houses_has_features.house_names_id, house_types.type, features.feature FROM house_names
JOIN houses_has_features
ON house_names.id = houses_has_features.house_names_id
JOIN house_types
ON house_types.id = houses_has_features.house_types_id
JOIN features
ON houses_has_features.features_id = features.id
WHERE house_names.name = \"$name[0]\"";
$query_join = $conn->query($query);
$rows = $query_join->num_rows;
echo '<p>';
//Output name and type for each item
$first_rows = $query_join->fetch_array(MYSQLI_ASSOC);
echo '<li class="list-group-item active">' . $first_rows['name'] . '</li>';
echo '<li class="list-group-item"><b>Type: </b>' . $first_rows['type'] . '</li>';
echo '<li class="list-group-item"><b>Features: </b>';
for($j = 0 ; $j < $rows ; ++$j) //Features loop
{
$query_join->data_seek($j);
$row = $query_join->fetch_array(MYSQLI_NUM);
//Output all features for each item
echo $row[4] . ', ';
};
};
// Close objects
$conn->close();
$query_join->close();
$query_names->close();
?>
</ul>
</div>
</div>
</body>
</html>
This is an article on unicode that's worth reading : The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets
The Single Most Important Fact About Encodings
If you completely forget everything I just explained, please remember one extremely important fact. It does not make sense to have a string without knowing what encoding it uses. You can no longer stick your head in the sand and pretend that "plain" text is ASCII.
There Ain't No Such Thing As Plain Text.
check the relative path and the URL is with WWW ot without www
Ok so after reading that post (thanks for the link), I switched the database to utf8mb4_bin and took out the entries with symbols and put them back in again found that the symbols are now showing :)
I also added to my header
thanks for all the help guys :)