Location: PHPKode > projects > SolBT > SolBT-1.3.0.11/clientes.xml.php
<?php
  include("../sol/sessao.php");
  
  $dados = new dados();
  $dados->get_conexao();
  
  if ($_GET['all'] == 'true') $ExprClinovo = ""; else $ExprClinovo = " cli_novo = 0 AND ";
  
  $sql = "SELECT id_inst, nome FROM instituicao WHERE ".$ExprClinovo." (id_inst = '".$_POST["id"]."' OR codigo_interno = '".$_POST["id"]."')";
  
  $rs = mysql_query($sql);
  
  if (mysql_num_rows($rs) > 0)
  {
    //Cria XML
    $xml = new DOMDocument("1.0", "UTF-8");
    $xml->preserveWhiteSpace = false;
    $xml->formatOutput = true;

    //Insere noh principal
    $root = $xml->createElement("clientes");
    
    while ($reg = mysql_fetch_array($rs))
    {
      $codigo = $xml->createElement("codigo", $reg["id_inst"]);
      $nome = $xml->createElement("nome", utf8_encode($reg["nome"]));
      
      //Cria nó de registro
      $cli = $xml->createElement("cliente");
      
      //Adiona campos com os valores
      $cli->appendChild($codigo);
      $cli->appendChild($nome);
      
      //Adiciona o registro ao noh prncipal
      $root->appendChild($cli);
    }
    
    //Fecha a TAG do nó principal
    $xml->appendChild($root);

    //Imprime o XML na tela
    Header("Content-Type: text/xml");
    echo $xml->saveXML();
  }
  
  @mysql_close();
?>
Return current item: SolBT