I am using PHP and MySQL for an application.
Questions are:
-
How to store data in
MySQLनवीन खेतिहर उपकरण।readable format orनिलेस र पà¥à¤¬format -
When user enters data in a textbox and clicks on submit, at that time we get data in different format. What we need to do should we convert and store in
MySQLin readable format.
Choose utf8 character set and
utf8_general_cicollation.Obviously, Collation of the field (to which you want to store Hindi text) should be
utf8_general_ci.To alter your table field, run
Once you’ve connected to database, run the following statement at first
Eg:
To retrieve data
Before you printing any unicode text (say Hindi text) on browser, you should have to set content type of that page by adding a meta tag
Eg:
Update:
mysql_query("SET CHARACTER SET utf8") has changed tomysql_set_charset(‘utf8’);This is the preferred way to change the charset. Using mysql_query() to set it (such as SET NAMES utf8) is not recommended. See http://php.net/manual/en/function.mysql-set-charset.php*