'); if (mysql_result(mysql_query("SELECT COUNT(*) from `applications` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') { $app_query = mysql_query("select * from applications WHERE device_id = '".$device['device_id']."' ORDER BY app_type"); while ($application = mysql_fetch_assoc($app_query)) { $app_enabled[] = $application['app_type']; } } echo("