Pretty simple piece of code; accepting user input for a name (quotes/apostrophe's valid), and then storing it in a mysql db;
$this->sql = new mysqli($this->host, $this->user, $this->pass, $this->dbname);
$firstname = $this->sql->real_escape_string($firstname);
$lastname = $this->sql->real_escape_string($lastname);
$sql = "INSERT INTO users
(firstname, lastname)
('{$firstname}', '{$lastname}')";
$this->sql->query($sql);
However, when in use, this is converting all quotes/apostrophe's into '
.
Would anyone have any ideas as to what could cause this? I've checked through the script for any htmlspecialchars or other methods being called.