send records in two separate tables [duplicate]
Solution 1:
Use 2 queries, not one. Of course it must be parameterized queries.
$stmt = $pdo->prepare("insert into comments (user_id,comment) values(?,?)");
$stmt->execute([$user_id,$comment]);
$stmt = $pdo->prepare("insert into comments2 (user_id,comment) values(?,?)");
$stmt->execute([$user_id,$comment]);
is all the code you need.