2016-06-10 18 views
0

如何從MySQL數據庫「印地文」取(印度當地語言)取हिन्दी文本在網站如何從MySQL數據庫「印地文」(印度當地語言)हिन्दी文本在網站

pictureofdatabase

當我從獲取數據庫中的數據顯示它

??????????????????????????????????????? 
???????????????????????? 
?????????????????????????????????????? 
?????????????????????????????????????? 

參考這個問題,我已經改變了我的數據庫字符集爲「utf8_u nicode_ci「,但仍然無法正常工作。我已經寫了下面的代碼來獲取數據

connection.php頁

<?php 

    $DB_HOST = 'localhost'; 
    $DB_USER = 'xxxxxxxx_usr'; 
    $DB_PASS = 'xxxxxxxxxxxxxxxxx'; 
    $DB_NAME = 'xxxxxxxs_dta'; 

    try{ 
     $DB_con = new PDO("mysql:host={$DB_HOST};dbname={$DB_NAME}",$DB_USER,$DB_PASS); 
     $DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 
    } 
    catch(PDOException $e){ 
     echo $e->getMessage(); 
    } 

index.php頁面

<?php include("../header.php"); ?><style> 
    .wrapper{position:relative;} 
    .right,.left{width:50%; position:absolute;} 
    .right{right:0;} 
    .left{left:0;} 
</style> <?php 

    require_once 'connect.php';?> 
<link href='/Lang/style.css' rel='stylesheet' type='text/css'> 
<?php 

$iddd =$_GET['id']; 
$d = $browser_t; ?> 

<div class="content"> 
<div class="dta"> 
    <?php 
    mysqi_set_charset($DB_con, 'utf8'); 
    $stmt = $DB_con->prepare('SELECT id, title, post, viewers, author, external FROM getpost WHERE id =:vid'); 

     $stmt->execute(array(':vid'=>$iddd)); 
    $stmt->execute(); 

    if($stmt->rowCount() > 0) 
    { 
     while($row=$stmt->fetch(PDO::FETCH_ASSOC)) 
     { 
      extract($row); 
      ?> 

    <div class="list_item"><h2><?php echo $row['title']; ?> Tutorials</h2></div> 

<div class="nykfont"> </div> 
<?php echo $row['post']; ?> 

<div class="content"> 
<div class="dta"> 
<div class="nykfont"> 
    <div class="lis_ite"><?php echo $row['external']; ?></div> 

    <div class="listt_itemm">Author<h5><a href="http://www.mrtutorials.net/Author/<?php echo $row['author']; ?>"><?php echo $row['author']; ?></a></h5></div></div> 
     <?php 
     } 
    } 
    else 

     ?> 

</div></div> 
<hr> 

    <?php include("../footer.php"); ?> 
+0

印地語不是本地的。它的國家語言 –

+0

你有沒有在你的index.php元標籤中設置你的編碼爲utf-8? – Otterbein

+0

是的,我已經設置,但沒有工作 –

回答

0

這解決了我同樣的問題。

ALTER TABLE tablename CHANGE COLUMN columnname VARCHAR(45) CHARACTER SET 'utf8' ;

希望解決你的了。

相關問題