In my script I loop through an array and create a single INSERT INTO string from it, with multiple values. When executing I get this error:
.. right syntax to use near 'INSERT INTO
As you can see, PHP adds a strange character in front of the string. The string is created with
$sql = "INSERT INTO table(`ItemID`, `Quantity`) VALUES ";
foreach($articles as $item)
{
$sql .= "(".$item['ItemID'].",".$item['Quantity']."),";
}
$sql = substr($sql, 0, -1); // to eliminate the trailing ","
$sql .= ";";
Why does PHP add this character and how can I detect and remove it? The file is saved as UTF-8 without BOM.