jimfog Posted October 3, 2013 Share Posted October 3, 2013 Whenever I make a connection to the db and perform whether this an update, a select or an insert I always set the chaset to utf8, like this: $connection->set_charset("utf8"); The question is the above needed in every kind of query.Is it needed for example in a SELECT statement where we do not put in the db? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 3, 2013 Share Posted October 3, 2013 It's needed if the server default is not UTF-8 and you want data returned as UTF-8. Link to comment Share on other sites More sharing options...
jimfog Posted October 5, 2013 Author Share Posted October 5, 2013 I just saw that in PHPMyAdmin,as a server connection collation, is mentioned utf_8_general_ci. Given that, do you still think the line of code showed above is needed? Link to comment Share on other sites More sharing options...
justsomeguy Posted October 7, 2013 Share Posted October 7, 2013 If you want to use that value for the connection collation then you don't need to change the character set. Link to comment Share on other sites More sharing options...
jimfog Posted October 7, 2013 Author Share Posted October 7, 2013 Sorry I did not quite understand your answer. I suppose you mean that if I want to stick with what the server has already as collation I should NOT use the code I list above. Is that what you mean/ Link to comment Share on other sites More sharing options...
justsomeguy Posted October 7, 2013 Share Posted October 7, 2013 Right, if you want to use the default then there's no reason to change it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now