I have data that is in json as follows:
[
{
"table":"activity",
"activity_id":"1414676438824",
"activity_ref":"61",
"activity_phase":"1",
"activity_group":"2"
}
]
I process this using a prepared statement like this:
$statement = $mysqli->prepare("INSERT INTO activity (activity_id, activity_ref, activity_phase, activity_group) VALUES (?, ?, ?, ?)");
foreach($jsonArray as $row) {
$statement->bind_param('siii', $row['activity_id'], $row['activity_ref'], $row['activity_group'], $row['activity_phase']);
$statement->execute();
}
In my table, the id
is BIGINT(20)
(it's actually a timestamp that is useful elsewhere).
The query fails when I include the id
field but is successful otherwise. I've tried changing the prepared statement to use a string (s
) and integer (i
) but with no luck.
I've tried changing, adding and removing quotes from my json.
Any ideas?