我想将数据插入到印地语的MySQL表中。我的数据是在excel中有字体devlys 10.of我复制并粘贴它不显示的查询。但如果我从谷歌翻译中复制一些印地语文本就需要了。我曾尝试将CSV用于该特定字体,但在导入后它不显示印地语,而是显示特殊字符。
对于数据库,表格和其他东西,我已经检查了正确设置的utf 8整理,但效果很好。
如果我从翻译器插入数据,则以印地语显示。所以问题是如何显示devlys 10印地语字体数据。?
这是我的代码......
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Demo - Import Excel file data in mysql database using PHP, Upload Excel file data in database</title>
<meta name="description" content="This tutorial will learn how to import excel sheet data in mysql database using php. Here, first upload an excel sheet into your server and then click to import it into database. All column of excel sheet will store into your corrosponding database table."/>
<meta name="keywords" content="import excel file data in mysql, upload ecxel file in mysql, upload data, code to import excel data in mysql database, php, Mysql, Ajax, Jquery, Javascript, download, upload, upload excel file,mysql"/>
</head>
<body>
<?php
define ("DB_HOST", "localhost"); // set database host
define ("DB_USER", "root"); // set database user
define ("DB_PASS",""); // set database password
define ("DB_NAME","uor"); // set database name
$link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make b
connection.");
$db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");
$databasetable = "data";
set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
include 'PHPExcel/IOFactory.php';
// This is the file path to be uploaded.
$inputFileName = 'discussdesk.xlsx';
try {
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
} catch(Exception $e) {
die('Error loading file
"'.pathinfo($inputFileName,PATHINFO_BASENAME).'":
'.$e->getMessage());
}
$allDataInSheet = $objPHPExcel->getActiveSheet()-
>toArray(null,true,true,true);
$arrayCount = count($allDataInSheet); // Here get total count of row in
that
Excel sheet
for($i=1;$i<=$arrayCount;$i++){
$name = trim($allDataInSheet[$i]["A"]);
$email = trim($allDataInSheet[$i]["B"]);
//$hname = mb_detect_encoding($email);
if($name) {
mysql_set_charset('utf8');
$insertTable= mysql_query("insert into data (name, email)
values('".$name."',
'".$email."')");
$msg = 'Record has been added. <div style="Padding:20px 0 0 0;"><a
href="">Go
Back to tutorial</a></div>';
} else {
$msg = 'Record already exist. <div style="Padding:20px 0 0 0;"><a href="">Go
Back to tutorial</a></div>';
}
}
echo "<div style='font: bold 18px arial,verdana;padding: 45px 0 0
500px;'>".$msg."</div>";
?>
<body>
</html>
答案 0 :(得分:0)
我认为Excel字体或任何其他字体无法存储在db中。 您只能存储数据