<?php
#   SGT - The SGT for Internet - http://sgt.eti.br
#   Copyright (c) 2016-2018, Jean Azevedo. All rights reserved.

#   This file is part of SGT.

#   SGT is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   any later version.

#   SGT is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.

#   You should have received a copy of the GNU General Public License
#   along with Foobar.  If not, see <http://www.gnu.org/licenses/>.

    ini_set('default_charset','UTF-8');
    include "../conectar.php";
    if($_SERVER['REQUEST_METHOD']=='GET'){
        $id_get=$_GET['cod_e'];
        $busca=$pdo_sgt->prepare("SELECT * FROM tb_equipamentos WHERE cod_e=:cod_e");
        $busca->bindValue(":cod_e",$id_get);
        $busca->execute();
        $dados=$busca->fetch(PDO::FETCH_ASSOC);
        $busca_unid=$pdo_sgt->prepare("SELECT * FROM tb_unidades WHERE id=:id");
        $busca_unid->bindValue(":id",$dados['unidade']);
        $busca_unid->execute();
        $dados_unid=$busca_unid->fetch(PDO::FETCH_ASSOC);
        $busca_set=$pdo_sgt->prepare("SELECT * FROM tb_setores WHERE id=:id");
        $busca_set->bindValue(":id",$dados['setor']);
        $busca_set->execute();
        $dados_set=$busca_set->fetch(PDO::FETCH_ASSOC);
        $busca_mod=$pdo_sgt->prepare("SELECT * FROM tb_modelos WHERE id=:id");
        $busca_mod->bindValue(":id",$dados['modelo']);
        $busca_mod->execute();
        $dados_mod=$busca_mod->fetch(PDO::FETCH_ASSOC);
        $busca_marc=$pdo_sgt->prepare("SELECT * FROM tb_marcas where id=:id");
        $busca_marc->bindValue(":id",$dados_mod['marca']);
        $busca_marc->execute();
        $dados_marc=$busca_marc->fetch(PDO::FETCH_ASSOC);
    }
?>