I have the following mysqli query:
$conn = new mysqli("localhost", "xx", "xx", "xx");
foreach ($response as $class) {
$sqle= "REPLACE INTO `items`
(`item_ids`)
VALUES
('{$class['id']}'";
if ($conn->query($sqle) === TRUE) {
//
} else {
echo "Problem";
}
}
This is my database table "items":
item_ids | item_class | item_subclass
-------------------------------------------
| 4 | 5
$response
is an API array from where I get the value for the item_ids .
I get the following error:
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 '' at line 4
I don´t understand what is wrong with my syntax here?
If I echo $class['id']
(without the query) in the foreach loop I get the expected values. So it´s a problem with the query inside of it.