Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
need to worry about the character set used by MySQL. If you work exclusively in English, you probably don't But, if you work with languages that use accented characters, or different writing systems, the character set used by MySQL effects the way PHP handles quotes and character escaping, when interacting with the database. This has important security implications when handling user input from online forms. Ideally, the character set should be set on the database server.
However, it can be changed using SQL statements. For example, set names utf8, or set character set utf8, will change the character set for the current connection. But, there's an important catch. PHP will not use the character set defined by a query when handling quotes and escaping characters. You must use the MySQLi set_charset() method.
To set the character set, open MYSQLi_connect.php in the includes folder. And, call the set, jar set method, on the database connection object, like this. So, it's db, the arrow operator, then set char set, and the value is passed as a string, utf8, and that's all that's necessary. You just need to save the page and that's it. This not only sets the character set for the current connection to MySQL, it also insures that PHP handles quotes and escape characters correctly.
UTF-8 should be appropriate for the vast majority of web applications. But, this page in the MySQL online documentation, describes how to find out which character sets are supported by your version of MySQL.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101634 Viewers
61 Video lessons · 88389 Viewers
71 Video lessons · 72227 Viewers
56 Video lessons · 103975 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.