Здравствуйте!
$ids_array = array(104, 106);
// ----------------
$comments_1 = [];
$stmt = $pdo->prepare("SELECT * FROM comments WHERE id IN (:ids) ORDER BY id DESC");
$stmt->execute(array(':ids' => implode(',', $ids_array)));
while ($row = $stmt->fetch()) {
$comments_1[] = $row;
}
// ----------------
$comments_2 = [];
$rows = $pdo->query("SELECT * FROM comments WHERE id IN (" . implode(',', $ids_array) . ") ORDER BY id DESC");
while ($row = $rows->fetch()) {
$comments_2[] = $row;
}
В итоге $comments_1 содержит 1 элемент, а $comments_2 - 2. Почему так?