Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8950285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:25:10+00:00 2026-06-15T13:25:10+00:00

I have a setup which loads data from MySQL with PHP and displays it

  • 0

I have a setup which loads data from MySQL with PHP and displays it in HTML. It works so far. All the characters are displayed how they should. But when I click a button to refresh a certain part of the site with $.ajax which calls PHP to refresh MySQL data, some characters are displayed as ?-marks, these are the characters which are MySQL data.

HOME

<!doctype html>
<html>
    <head>
    <meta charset="UTF-8">
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript">
        $(function() {
            $("div#click input").live("click", function() {
                $("div#main").load("main.php");
            });
        });
    </script>
    </head>

    <body>
        <div id="main">
        é¨ûåa
        </div>

        <div id="click">
        <input type="button" value="click" onclick="return false;" />
        </div>
    </body>
</html>

Main.php

<?php
$a = mysql_connect('localhost', 'root', '');
mysql_select_db('link', $a);

?>
<div id="main">
ééîüåaa

</div>

<?php
$r = mysql_query("SELECT * from promo;");

while ($row = mysql_fetch_object($r)) {
        $name       = $row->name;
        echo $name;
}
mysql_close($a);
?>

MySQL table:

CREATE TABLE `promo` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL DEFAULT '',
  `link` tinytext NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:25:11+00:00Added an answer on June 15, 2026 at 1:25 pm

    try using this call before making your mysql_query

    mysql_set_charset("utf8")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a setup with three different UIWebViews which loads data from the internet.
I have a layout setup which can be view here: http://jsfiddle.net/Pn3ts/ It all works
I have just setup a new local site (localhost/pfb.net/) which has been cloned from
I have 24/7 service which keeps setup (configuration data) for charging, routing and etc
I'm using Quartz.NET to schedule a job which loads a bunch of data from
Setup: I have a custom class I've created that handles data retrieved from a
I have a main form that loads and immediately start receiving data from a
I have a Silverlight App which gets its data from a database. My Silverlight
Say I have a www.foo.com domain which is setup to load my app on
I have setup my site with 5 pages which are my menu options. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.