I'm taking data from an external XML file, so I cannot make changes. Also I need all special characters.
This is XML
<item>
<name>Lucy</name>
<embed><iframe src='http://website.com style='something:somehow'></iframe></embed>
</item>
This is sql table
$sql = "CREATE TABLE IF NOT EXISTS `models`(
`model_id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`model_username` VARCHAR(250) NOT NULL,
`model_embed` TEXT NOT NULL )";
XML into SQL
foreach ($items as $item) {
$name=$item->name;
$iframe=$item->embed;
$ins = " INSERT INTO `models` (`model_username`, `model_embed`)
VALUES ('$name', '$iframe')
}
And I get this error
1064 : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'http://website.com style='something:somehow' at line 9