Ir para conteúdo
Fórum Script Brasil

Fabiom2211

Membros
  • Total de itens

    2
  • Registro em

  • Última visita

Tudo que Fabiom2211 postou

  1. Já conseguir resolver o meu problema.. embaixo tá o código correto... Att, Fabio <?php echo '-----[ Usando XMLReader ]-----<br>' , PHP_EOL; $xmll = new XMLReader(); $xmll->open( 'mes_qtd.xml' ); $manipulador_arq = fopen("fabio.xml","w+"); @fwrite($manipulador_arq,"<graph caption='Total de Quantidade' subcaption='Vendida no Mes' xAxisName='Mes' yAxisName='Quantidade' numberPrefix=''>"); while ( $xmll->read() ){ if ( ( $xmll->nodeType == XMLReader::ELEMENT ) && ( $xmll->name == 'set' ) ){ $name = $xmll->getAttribute( 'name' ); $value = $xmll->getAttribute( 'value' ); $xml = "<set "; $xml .= "name='$name' "; $xml .= "value='$value' "; $xml .= " /> "; @fwrite($manipulador_arq,$xml); $xml = "\n \n"; } } @fwrite($manipulador_arq,"\n\n</graph>"); ?> [/php]
  2. Fiz uma consulta do arquivo XML com php... A partir dessa consulta quero criar um arquivo xml... Eu consigo criar o arquivo xml...mais não to conseguindo colocar as variaveis no arquivo xml Código: <?php echo '-----[ Usando XMLReader ]-----<br>' , PHP_EOL; $xmll = new XMLReader(); $xmll->open( 'mes_qtd.xml' ); $manipulador_arq = fopen("fabio.xml","w+"); @fwrite($manipulador_arq,"<graph caption='Total de Quantidade' subcaption='Vendida no Mes' xAxisName='Mes' yAxisName='Quantidade' numberPrefix=''>"); while ( $xmll->read() ){ if ( ( $xmll->nodeType == XMLReader::ELEMENT ) && ( $xmll->name == 'set' ) ){ echo 'name="' , $xmll->getAttribute( 'name' ) ; echo '"', PHP_EOL; echo 'value="' , $xmll->getAttribute( 'value' ); echo '"', PHP_EOL; echo 'link="' , $xmll->getAttribute( 'link' ) ; echo '"', PHP_EOL; echo '<br>' , PHP_EOL; $xml = "<set "; //$xml .= "name= getAttribute( 'name' ) "; //$xml .= "value= getAttribute( 'value' ) "; //$xml .= "link=getAttribute( 'link' ) "; $xml .= " /> "; @fwrite($manipulador_arq,$xml); $xml = "\n \n"; } } ?> A parte que está comentada no meu código é a parte que escreve no arquivo xml mais isso não funciona... alguém sabe como posso escrever no arquivo xml as variaveis de consulta??
×
×
  • Criar Novo...