简体   繁体   中英

mysql_real_escape_string and special characters

I'm working on OpenCart to make an application for importing data from an ERP. In some descriptions of the items is sometimes used the character "°" (degree). The application of insert of the standard software in question used "mysql_real_escape_string" and accepts the character specified above. In my application I use the same function, but the function imports only the previous characters before of "°" and then moves on to the next product. I've tried to debug and the variable contains the rightdescription. Certenly there's an error, but I don't understand where is. Has anyone had a similar problem and solved it? How?

thanks bye

This is my code

$this->db->query("UPDATE " . DB_PREFIX . "product_description SET name = '" .  $this->db->escape($description_it) . "' WHERE product_id = '" . (int)$product_id  . "' AND language_id = '2'");

and this is the function of Opencart

public function escape($value) {
    if ($this->link) {
        return mysql_real_escape_string($value, $this->link);
    }
}

reverse params:

string mysqli_real_escape_string ( mysqli $link , string $escapestr )

you need change your rows:

 mysql_real_escape_string($this->link, $value);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM