(抱歉改变)我在表中使用韩语但是当我使用这个php文件时输出为???我想展示韩国和表一样不是???我该怎么改变它?
<?php
DEFINE ('DBUSER', 'root');
DEFINE ('DBPW', '****');
DEFINE ('DBHOST', 'locashost');
DEFINE ('DBNAME', 'shopping');
header("Content-Type: text/csv; charset=UTF-8");
$dbc = mysqli_connect(DBHOST,DBUSER,DBPW);
if (!$dbc) {
die("Database connection failed: " . mysqli_error($dbc));
exit();
}
$dbs = mysqli_select_db($dbc, DBNAME);
if (!$dbs) {
die("Database selection failed: " . mysqli_error($dbc));
exit();
}
# mysql_query("set session character_set_connection=utf8;");
# mysql_query("set session character_set_results=utf8;");
# mysql_query("set session character_set_client=utf8;");
$barcode = mysqli_real_escape_string($dbc, $_GET['barcode']);
$result = mysqli_query($dbc, "SHOW COLUMNS FROM product");
$numberOfRows = mysqli_num_rows($result);
if ($numberOfRows > 0)
{
$values = mysqli_query($dbc, "SELECT * FROM product WHERE barcode=$barcode");
while ($rowr = mysqli_fetch_row($values)) {
for ($j=0;$j<$numberOfRows;$j++) {
$csv_output .= $rowr[$j].", ";
}
$csv_output .= "\n";
}
}
print $csv_output;
exit;
?>