i want to insert my data to database. i have data that separated with commas.
i try like this but look like something wrong.
$rand_post = ["3001182708", "3001182713", "3001183215"];
$id_post = '123456';
$prep = array();
foreach($rand_post as $v ) {
$prep[] = "($id_post, $v)";
}
print_r($prep);
$sth = $db->prepare("INSERT INTO tes (`id_post`,`datas`) VALUES " . implode(', ', $prep));
$res = $sth->execute($prep);
i want to insert my data like this
id_post rand_post
============ ================
123456 3001182708
123456 3001182713
123456 3001183215
$preparray