php unicode charaters show ஆணà¯à®•à®³à¯
例如:
治疗数据显示正确,但性别类别和疾病数据未正确显示图像显示我的输出,请如何解决此问题。
代码是:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../library/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="../library/bootstrap/css/bootstrap-responsive.min.css" />
<link rel="stylesheet" type="text/css" href="../library/css/style.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".update_input").hide();
$("#edit").click(function(){
$("#danger").hide();
$(".help-block").hide();
$(".update_input").show();
$("#update").show();
});
$("#update").click(function(){
$(".update_input").hide();
$("#update").hide();
$(".help-block").show();
});
$("#danger").click(function(){
var id = $(".hiden_id").attr('id');
var dataString = 'id='+ id;
if(confirm("Sure you want to delete this update? There is NO undo!"+id))
{
$.ajax({
type: "POST",
url: "delete.php",
data: dataString,
cache: false,
success: function(e)
{
window.location.href="all_pages.php";
e.stopImmediatePropagation();
}
});
return false;
}
});
});
</script>
</head>
<body>
<?php
session_start();
ini_set('display_errors', 'Off');
if($_GET["id"]==""){
$_GET["id"] = $_SESSION['trid'];
}
else {
$_SESSION['trid']=$_GET["id"];
}
?>
<?php
$con=mysqli_connect("mysql2.000webhost.com","a3821029_admin","abc123","a3821029_ayurved");
mysql_set_charset('utf8', $con);
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
if(!$_GET["id"]==""){
$Treatment_id = $_SESSION['trid'];
$result = mysqli_query($con,"SELECT gender_id, diseases_id, Treatments_type, image FROM treatment WHERE Tid = '$Treatment_id'");
$row_gid = mysqli_fetch_array($result);
$gender = $row_gid['gender_id'];
$diseases = $row_gid['diseases_id'];
$Treatments_type = $row_gid['Treatments_type'];
$image = $row_gid['image'];
$select = mysqli_query($con,"SELECT category FROM gender WHERE id = '$gender'");
$select_gender = mysqli_fetch_array($select);
$Gender_name = $select_gender['category'];
$sl_dise = mysqli_query($con,"SELECT Diseases_type FROM diseases WHERE id = '$diseases'");
$row_did = mysqli_fetch_array($sl_dise);
$diseases_value = $row_did['Diseases_type'];
}
else{
header('Location: ./all_pages.php');
}
?>
<div class="container">
<div class="selection_container">
<div class="page-header">
<h1><img src="../resources/images/leaf_green.gif" class="adminpanel_icons">Ayurvedic Web Portal</h1>
</div>
<a href="all_pages.php">Back to view all_pages</a>
<form class="form-horizontal" method="post" action="update_edit.php" enctype="multipart/form-data" accept-charset="utf-8">
<div class="tablecox">
<table style="" class="" id="update_table">
<input type="hidden" name="tid" class="hiden_id" value="<?php echo $Treatment_id;?>" id="<?php echo $Treatment_id;?>"></input>
<tr>
<td style="width: 30%; text-align: right; padding-right: 30px;">Gender category</td>
<td style="width: 70%;">
<span class="help-block" id="gender_span"><?php echo $Gender_name; ?></span>
<select name="gender" class="update_input" id="gender_input">
<option value="<?php echo $gender; ?>">Select</option>
<option value="10">Male</option>
<option value="11">Female</option>
<option value="12">Childs</option>
<option value="13">Childrens</option>
<option value="14">Elderly people</option>
</select>
</td>
</tr>
<tr>
<td style="width: 30%; text-align: right; padding-right: 30px;">Diseases</td>
<td>
<span class="help-block"><?php echo $diseases_value; ?></span>
<input type="text" name="disease" class="update_input" id="disease_update" value="<?php echo $diseases_value; ?>">
</td>
</tr>
<tr>
<td style="width: 30%; text-align: right; padding-right: 30px;">Treatment</td>
<td>
<span class="help-block"><?php echo $Treatments_type; ?></span>
<textarea class="update_input" name="treatment" id="treatment_update" rows="8"><?php echo $Treatments_type; ?></textarea>
</td>
</tr>
<tr>
<td style="width: 30%; text-align: right; padding-right: 30px;"></td>
<td>
<img src="../uploads/<?php echo $image; ?>" style=" max-height: 200px; padding-bottom: 20px;">
<input type="file" class="update_input" id="exampleInputFile" name="userfile" value=""/>
</td>
</tr>
</table>
</div>
<br>
<button class="btn" id="edit" type="button">Edit</button>
<input class="btn" id="update" type="submit" name="submit" value="update">
<button type="button" class="btn btn-danger" id="danger">Delete</button>
</form>
</div>
</div>
</body>
</html>
治疗数据显示正确,但性别类别和疾病数据未正确显示图像显示我的输出,请如何解决此问题。
答案 0 :(得分:0)
由于你使用MySQLi,你应该使用MySQLi charset命令,而不是旧的MySQL字符集:
mysqli_set_charset ( $con , 'utf8' )