<?php
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
session_start();
ob_start();
if($_SESSION['sml_si']!=session_id()) {
    die();
}
require_once("../functions.php");
require_once("../../db/connection.php");
$id = strip_tags($_POST['id']);
$return = array();
$query = "SELECT * FROM sml_markers_connects WHERE id=? LIMIT 1;";
if($smt = $mysqli->prepare($query)) {
    $smt->bind_param('i',$id);
    $result = $smt->execute();
    if($result) {
        $result = get_result($smt);
        if(count($result)==1) {
            $return = array_shift($result);
            $return['array_lang'] = array();
        }
    }
}
$query = "SELECT * FROM sml_markers_connects_lang WHERE id_marker_connect=? LIMIT 1;";
if($smt = $mysqli->prepare($query)) {
    $smt->bind_param('i',$id);
    $result = $smt->execute();
    if($result) {
        $result = get_result($smt);
        if(count($result)==1) {
            while($row = array_shift($result)) {
                $language = $row['language'];
                unset($row['language']);
                $return['array_lang'][$language] = $row;
            }
        }
    }
}
ob_end_clean();
echo json_encode($return);