What the code in PHP to do that:
$string = '123,456,789,102'
$value = '564'
How to split $string
into an array then concatenated each value in the array with $value into two dimensional array, so the final result:
$result = (
(564,123),
(564, 456),
(564, 789),
(564, 102)
)
So $result can be used in inserting multiple rows in mysql using PDO:
$stmt = $this->pdo->prepare('INSERT INTO tbl_user (id, bought) VALUES ((?,?),
(?,?),
(?,?),
(?,?),
(?,?),
)');
$stmt->execute($result);
note: id and bought columns are varchar