function select_video($id, $lang){
db_connect();
$query = "SELECT `video`.*, (SELECT count(c.`id`) FROM `comments` c WHERE c.`note_id` = `video`.`title_url` AND c.`lang` = '{$lang}') comments_count
FROM `video`
WHERE `video` .`id` > (SELECT v.`id` FROM `video` v WHERE v.`id` < {$id} ORDER BY v.`id` DESC LIMIT 1) AND `video`.`lang` = '{$lang}'
ORDER BY `video` .`id` ASC
LIMIT 3";
$res = mysql_query($query);
for($i=0; $row = mysql_fetch_array($res); $i++){
$result[$i] = $row;
}
return $result;
}