mysql_query and set parameters

Hello all,

I have been checking some update information regarding the newer version of mysql.
As I have been using:


        mysql_query("SET 
                    character_set_results = 'utf8', 
                    character_set_client = 'utf8', 
                    character_set_connection = 'utf8', 
                    character_set_database = 'utf8', 
                    character_set_server = 'utf8'", $link);
                    mysql_set_charset('utf8',$link);

I noticed in http://php.net/manual/en/function.mysql-set-charset.php that mysql_set_charset will be deprecated as of PHP 5.5.

My question is whether it is better to use the mysql_query set as above or to code it this way

mysql_query("SET CHARACTER SET 'utf8'");

?

Also, is there an underscore version of

mysql_query("SET NAMES 'UTF8'");

?

anyone?

All mysql_ functions have been deprecated as of PHP 5.5 and the mysqli_ or PDO need to be used instead, as stated in the manual, so it’s best to move away from the mysql_ functions entirely.

Thanks, I will have a look at that.