Welcome Guest, Not a member yet? Register   Sign In
mysqli_real_escape_string()
#11

[eluser]Daniel MC[/eluser]
I found the solution to this problem, is very easy: attach @ to begin mysql_real_escape_string($str, $this->conn_id);
Code:
/**
     * Escape String
     *
     * @access    public
     * @param    string
     * @param    bool    whether or not the string will be used in a LIKE condition
     * @return    string
     */
    function escape_str($str, $like = FALSE)    
    {    
        if (is_array($str))
        {
            foreach($str as $key => $val)
               {
                $str[$key] = $this->escape_str($val, $like);
               }
            return $str;
        }        
        if (function_exists('mysql_real_escape_string') AND is_resource($this->conn_id))
        {
            $str = @mysql_real_escape_string($str, $this->conn_id);            
        }
        elseif (function_exists('mysql_escape_string'))
        {
            $str = mysql_escape_string($str);
        }
        else
        {
            $str = addslashes($str);
        }        
        // escape LIKE condition wildcards
        if ($like === TRUE)
        {
            $str = str_replace(array('%', '_'), array('\\%', '\\_'), $str);
        }
        
        return $str;
    }
#12

[eluser]kodai[/eluser]
It seem so many problems/bugs regarding db functions start from SVN 1.7x, but seem no one from dev. which can explain further or change the code. Sad




Theme © iAndrew 2016 - Forum software by © MyBB