Home >Database >Mysql Tutorial >How Can I Store and Display Unicode Strings in MySQL and PHP?
Storing and Displaying Unicode Strings (हिन्दी) Using PHP and MySQL
To store and display Unicode strings like "सूर्योदय" in a MySQL database and retrieve them using PHP, follow these steps:
Database Setup:
Storing the String:
Ensure your PHP script sets the character set properties correctly:
Retrieving and Displaying the String:
Additional Tips:
Set the Content-Type for your HTML document to UTF-8 using:
Alternative Solution:
Note:
The provided sample script uses the older mysql_ functions. For newer PHP versions, use the mysqli or PDO extensions for database interactions. The syntax will slightly differ, but the overall principles remain the same.
The above is the detailed content of How Can I Store and Display Unicode Strings in MySQL and PHP?. For more information, please follow other related articles on the PHP Chinese website!