Hi i have data stored in hindi in mysql server and am unable to show it as output here is my code
<?php
//string utf8_decode(string $product);
/*mysql_query('SET character_set_results=utf8');
mysql_query('SET names=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_results=utf8');
mysql_query('SET collation_connection=utf8_general_ci');*/
header( 'Content-Type: text/html; charset=utf-8' );
// array for JSON response
$response = array();
require_once __DIR__ . '/db_connect.php';
// connecting to db
$db = new DB_CONNECT();
$result = mysql_query("SELECT *FROM create_event") or die(mysql_error());
if (mysql_num_rows($result) > 0) {
// looping through all results
// products node
$response["create_event"] = array();
while ($row = mysql_fetch_array($result)) {
// temp user array
$product = array();
$product["eventid"] = $row["eventid"];
$product["description"] = $row["description"];
$product["title"] = $row["title"];
$product["startdate"] = $row["startdate"];
$product["enddate"] = $row["enddate"];
// push single product into final response array
array_push($response["create_event"], $product);
}
// success
$response["success"] = 1;
// echoing JSON response
echo json_encode($response, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
} else {
// no products found
$response["success"] = 0;
$response["message"] = "No products found";
// echo no users JSON
echo json_encode($response, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE);
}
?>
the data is stored in utf8_unicode_ci format in mysql server
and here is the output i am getting from php code in browser
{"create_event":
[{"eventid":"1","description":"????????","title":"?????","startdate":"5-12-12","enddate":"5-12-45"}],"success":1}
the data with value ????????
k is the data which is stored in hindi.Kindly,help me on this as i am new in php.
Thanks!!!