Skip to content

Instantly share code, notes, and snippets.

@s-melnikov
Last active February 8, 2016 21:00
Show Gist options
  • Save s-melnikov/b7e93e9fe7943b5dfce9 to your computer and use it in GitHub Desktop.
Save s-melnikov/b7e93e9fe7943b5dfce9 to your computer and use it in GitHub Desktop.
<?php
// массив для результата выборки
$data = array();
if (isset($_POST['filter'])) {
foreach ($_POST['info_department'] as $selected) {
$sql = "SELECT * FROM info WHERE info_department = '$selected' ORDER BY info_id DESC";
$result = $connect->query($sql);
$result_array = $result->fetch_all(MYSQLI_ASSOC);
//складываем все в один массив (мержим массивы)
$data = array_merge($data, $result_array);
}
}
var_dump($data); //результат выборки
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment