$query = "SELECT v.* FROM video_category
INNER JOIN video_category vc ON vc.category_id = video_category.category_id
INNER JOIN videos v ON v.id = vc.video_id
WHERE video_category.video_id=$id
ORDER BY vc.video_id DESC LIMIT 12";
$res = mysqli_query($connection, $query);
$bin = array_unique($res);
$res = array_map("unserialize", array_unique(array_map("serialize", $res)));