mysqli_real_escape_string() , does not add back slashes
<p>I can't find any reasons why <code>mysqli_real_escape_string</code> does not add back slashes when entering data to database. I have checked the manual and it's says<br>
<code>mysqli_real_escape_string</code> needs to have 2 parameters. The other parameters is your database connection, when I check data in database I found single quotes and no back slashes added.  Maybe something wrong with code down below. I don't know how to use prepared statements, any help please..!  </p>

<pre><code>function open_handler()
{
            // Connects to MYSQL
            $connect = new mysqli(HOST,USER,PASS,DB);

            // Logic Checks
            if($connect)
            {
                // MYSQL SET TO UTF8 ENCODING
                @mysqli_query('set names "utf-8"');
                @mysqli_query('set character set "utf8"');
                @mysqli_query('set character_set_server="utf8"');
                @mysqli_query('set collation_connection="utf8_general_ci"');
            }

            if(!$connect)
            {
                die('UNABLE TO CONNECTION TO MYSQL SERVER');
            }

            return $connect;    

        }

function add_user($uname,$pwd,$email)
    {
        $n_uname    = mysqli_real_escape_string(open_handler(),$uname);
        $n_pwd      = $pwd; 
        $n_email    = $email;       

        $sql  = sprintf("INSERT INTO `users` SET
                                             `uname`='%s', 
                                             `pwd`='%s', 
                                             `email`='%s',
                                              $n_uname,$n_pwd,$n_email);
        $query = mysqli_query(open_handler(),$sql);

        // logic check
        if(!$query)
            {return FALSE;}
        else
            {return TRUE;}
         @mysqli_free_result($query);   

    }
</code></pre>
