I have a main page on which i want to display part of my blog (wordpress) articles. The mysqli query result is displaying some characters i never intended( changing quotation marks to question marks etc). Find here http://myimcm.com. Declared charset in the head tag as UTF-8. I also check the database CHASET, still UTF-8 as this were suggested to be the usual cause. Why is this still so please? Any guide will be appreciated.
The querry codes read:

$q ="SELECT SUBSTRING_INDEX(post_content,' ',130) AS post,(post_title) AS title,ID AS id FROM wp_posts WHERE post_type='post' ORDER BY post_date DESC LIMIT 1";
$r = @mysqli_query ($dbc, $q); // Run the query.
if ($r) { // If it ran OK, display the records.
    echo '<h2>LATEST FROM OUR GUIDES</h2>'; 
// Fetch and print all the records:
while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) {
     echo"<p class='title'>". ($row['title'])."</p>";
     echo nl2br($row['post']);
echo '<a href="http://guides.myimcm.com/wp"> </a>';
    mysqli_free_result ($r); // Free up the resources.  
} else { // If it did not run OK.
    // Public message:
    echo '<p class="error">The are no latest from our blog. We apologize for any inconvenience.</p>';
    // Debugging message:
    echo '<p>' . mysqli_error($dbc) . '<br /><br />Query: ' . $q . '</p>';
} // End of if ($r) IF.
mysqli_close($dbc); // Close the database connection.

The connection script is this:

$dbc = @mysqli_connect( "localhost", "xxxx", "xxxx","xxxx");
if(!$dbc){trigger_error( 'Could not connect to MYSQL:' .mysqli_connect_error());

Read more here: Displaying mysqli result returns bad char


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , ,

Wordpress related questions and answers: