How to display in php special characters from mysql
Posted: 04 Nov 2018, 13:38
I prefer not to bother you too often but because of my bad English, two accounts have already been blocked on stack overflow.
And I think you are mutch better
I have this script but I get strange results with special characters like € or Ë
How can I make those display correctly?
Page/data.php
And I think you are mutch better
I have this script but I get strange results with special characters like € or Ë
How can I make those display correctly?
Code: Select all
<?php include_once 'Page/data.php'; ?>
<?php
foreach($result as $row) {
echo '
<span class="w3-right w3-opacity">
'. $row['itime']. '
</span>
<p>'. $row['ibody']. '</p>
</div> <br><br><br>
';
}
?>
Code: Select all
<?php
//include configuration file
require 'configuration.php';
$start = 0; $per_page = 4;
$page_counter = 0;
$next = $page_counter + 1;
$previous = $page_counter - 1;
if(isset($_GET['start'])){
$start = $_GET['start'];
$page_counter = $_GET['start'];
$start = $start * $per_page;
$next = $page_counter + 1;
$previous = $page_counter - 1;
}
// query to get messages from messages table
$q = "SELECT * FROM politicsnucleus_item WHERE iblog=1 ORDER BY inumber DESC LIMIT $start, $per_page ";
$query = $db->prepare($q);
$query->execute();
if($query->rowCount() > 0){
$result = $query->fetchAll(PDO::FETCH_ASSOC);
}
// count total number of rows in students table
$count_query = "SELECT * FROM politicsnucleus_item ";
$query = $db->prepare($count_query);
$query->execute();
$count = $query->rowCount();
// calculate the pagination number by dividing total number of rows with per page.
$paginations = ceil($count / $per_page);
?>