zohab Posted December 19, 2007 Share Posted December 19, 2007 hi all i am trying to insert japanese data into mysql table but with the following insert query it insert some garbage value into the database. $details1='あのサン自動車工業製'; $details2='あのサン自動車工業製'; mysql_query("SET NAMES utf8"); $sql = "update products_description set commodity_details1='$commodity_details1' and commodity_details2='$commodity_details2' where products_id=8"; echo"<br>".$sql; $result = mysql_query($sql); mysql_free_result($result); ------------------------------------------------------------------------------------------------- with following code when i am trying to display japanese text from database it displays some garbage values even i enter correct text into database it displays garbage value. $conn = mysql_connect("host", "login","password"); if (!$conn) { echo "Unable to connect to DB: " . mysql_error(); exit; } if (!mysql_select_db("database")) { echo "Unable to select mydbname: " . mysql_error(); exit; } mysql_query("SET NAMES utf8"); //mysql_query("SET CHARACTER SET utf8"); $sql = "select * from products_description where products_id=8"; $result = mysql_query($sql); //echo"<br>".$num_rows = mysql_num_rows($result); while ($row = mysql_fetch_assoc($result)) { echo $row["commodity_details1"]; echo $row["commodity_details2"]; } any ideas? thanks in advance zohab Link to comment https://forums.phpfreaks.com/topic/82276-problem-with-mysql_queryset-names-utf8/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.