<?php
function get_servbus($anagr_id){
	$anagr_id = intval($anagr_id);
	$result = $GLOBALS['mysqli']->query("SELECT * FROM serv_bus WHERE anagr_id = ".$anagr_id);
	if($result->num_rows == 0)
		return false;
	else
		$servizio = $result->fetch_assoc();
		
	//delegati ritiro 
	$servizio['delegati'] = array();
	$result = $GLOBALS['mysqli']->query("SELECT deleg_id, CONCAT_WS(' ', deleg_cognome, deleg_nome) AS nome FROM servizi_delegati WHERE serv_cod = 'bus' AND anagr_id = ".$anagr_id);
	while($row=$result->fetch_assoc())
		$servizio['delegati'][$row['deleg_id']] = $row['nome'];
	
	return $servizio;
}
?>