g_p_java Posted August 11, 2010 Share Posted August 11, 2010 Hello, i use MySQL with PHP. My php version is 5.2.0. After i connect to the db i use mysql_set_charset in order to change the system variables (character_set_client , character_set_results ,character_set_connection). i do: if (USE_PCONNECT == 'true') { $$link = mysql_pconnect($server, $username, $password); mysql_set_charset('utf8',$$link); } else { $$link = mysql_connect($server, $username, $password); mysql_set_charset('utf8',$$link); } I take the error: Fatal error: Call to undefined function mysql_set_charset(). In the manual page for mysql_set_character says: 1."(PHP 5 >= 5.2.3)" --> that means that i have an old php version?? 2."Note: This is the preferred way to change the charset. Using mysql_query() to execute SET NAMES .. is not recommended. " What shall i do in order to solve my problem?? thanks, in advance! Link to comment https://forums.phpfreaks.com/topic/210489-fatal-error-call-to-undefined-function-mysql_set_charset/ Share on other sites More sharing options...
Floydian Posted August 11, 2010 Share Posted August 11, 2010 Hello g_p_java You are 3 revisions shy of having a new enough version of PHP. I would definitely upgrade, to a newer version of PHP 5.2.x (I think it's 5.2.14 now) I doubt any code will break by doing this, so it should be pretty easy for ya. Cheers Link to comment https://forums.phpfreaks.com/topic/210489-fatal-error-call-to-undefined-function-mysql_set_charset/#findComment-1098285 Share on other sites More sharing options...
g_p_java Posted August 13, 2010 Author Share Posted August 13, 2010 if i use mysql_query('SET NAMES utf8 ') instead of mysql_set_charset, is that the same?? Link to comment https://forums.phpfreaks.com/topic/210489-fatal-error-call-to-undefined-function-mysql_set_charset/#findComment-1098860 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.