wpoprovider Posted May 26, 2011 Share Posted May 26, 2011 Hi, I have been working with inserting unicode characters into mssql database from a php application. My php web application displays the chinese characters as i entered and retrieves from database properly. But when I take a look at the database the fields are populated with some other values other than the characters i inserted. When i developed the same application in ASP.net the database has correct values inserted into it. Here is my code in php: <?php // direct insert $var = mssql_connect('RAL-DEV-SQL01','TestDBSa','TestDB$@'); $selected = mssql_select_db('TestDB', $var); $myVar="日常生活"; $myChineseVar=$myVar; echo $myChineseVar; $query = "insert into TestChinese (TestName) values (N'{$myChineseVar}')"; $result = mssql_query($query,$var); echo "Inserted<br>"; echo $query; echo "<br>Result<br>"; $result2 = mssql_query("SELECT TOP 10 * FROM [TestChinese] order by SeqNum desc",$var); while($nt=mssql_fetch_array($result2)){ echo "$nt[seqNum] - "."$nt[TestName] -"; echo "<br>"; } mssql_close($var); ?> Can someone help me with this problem Thanks Quote Link to comment https://forums.phpfreaks.com/topic/237537-unicode-php-mssql/ Share on other sites More sharing options...
Maq Posted May 26, 2011 Share Posted May 26, 2011 - Please be conscious of where you post, I moved your thread to the correct section. - Read the forums rules and section descriptions before creating a thread! - In the future, please place tags around your code. Quote Link to comment https://forums.phpfreaks.com/topic/237537-unicode-php-mssql/#findComment-1220632 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.