Something like the fol SQL will get the data for a given incident id: (lots of ash and trash here, but the LEFT JOINS fill in the useful linked values.)
You'll need to watch out for possible ambiguity in field names: Like id, description, etc.that are common to several tables, with id common to all.
It really depends on just what information schema you want to broadcast.
Come back, A
$query = "SELECT *,
`problemstart` AS `my_start`,
FROM_UNIXTIME(UNIX_TIMESTAMP(problemstart)) AS `test`,
UNIX_TIMESTAMP(problemstart) AS problemstart,
UNIX_TIMESTAMP(problemend) AS problemend,
UNIX_TIMESTAMP(date) AS date,
UNIX_TIMESTAMP(booked_date) AS booked_date,
UNIX_TIMESTAMP(`$GLOBALS[mysql_prefix]ticket`.`updated`) AS updated,
`$GLOBALS[mysql_prefix]ticket`.`description` AS `tick_descr`,
`$GLOBALS[mysql_prefix]ticket`.`lat` AS `lat`,
`$GLOBALS[mysql_prefix]ticket`.`lng` AS `lng`,
`$GLOBALS[mysql_prefix]ticket`.`_by` AS `call_taker`,
`$GLOBALS[mysql_prefix]facilities`.`name` AS `fac_name`,
`rf`.`name` AS `rec_fac_name`,
`$GLOBALS[mysql_prefix]facilities`.`lat` AS `fac_lat`,
`$GLOBALS[mysql_prefix]facilities`.`lng` AS `fac_lng`,
`$GLOBALS[mysql_prefix]ticket`.`id` AS `tick_id`
FROM `$GLOBALS[mysql_prefix]ticket`
LEFT JOIN `$GLOBALS[mysql_prefix]in_types` `ty` ON (`$GLOBALS[mysql_prefix]ticket`.`in_types_id` = `ty`.`id`)
LEFT JOIN `$GLOBALS[mysql_prefix]facilities` ON `$GLOBALS[mysql_prefix]facilities`.id = `$GLOBALS[mysql_prefix]ticket`.facility
LEFT JOIN `$GLOBALS[mysql_prefix]facilities` rf ON `rf`.id = `$GLOBALS[mysql_prefix]ticket`.rec_facility
WHERE `$GLOBALS[mysql_prefix]ticket`.`ID`= $id "