Fatal error: Call to undefined function mysql_set_charset()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
g_p
Forum Newbie
Posts: 13
Joined: Sun Jan 25, 2009 9:49 am

Fatal error: Call to undefined function mysql_set_charset()

Post by g_p »

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:

Code: Select all

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!
Post Reply