How to remove the red part of the figure?

1

require("setup_do_banco.php");

$colunas    = $pdo->prepare("SELECT * FROM origem WHERE ativado = 1");
$colunas->execute();

while ( $coluna = $colunas->fetchAll(PDO::FETCH_ASSOC) ) { $array_banco = $coluna; }

foreach($array_banco as $item){

    $fields[] = sprintf("'%s' => '%s'", $item['field'], $item['description']);

}

$array = array (
    'key'       => '8b0dc65f996f98fd178a9defd0efa077',
    'module'    => 'imoveis',
    'method'    => 'busca_imoveis',
    'field'     => $fields
);

$client = new SoapClient(null, array (
    'uri' => 'http://soap.imo.bi/',
    'location' =>
    'http://soap.imo.bi/soap.dll',
    'trace' => 'trace'
    )
);
  

Update 1

I think the code below is more correct, right?

require("setup_do_banco.php");

$colunas    = $pdo->prepare("SELECT * FROM origem WHERE ativado = 1");
$colunas->execute();

$array_banco = $colunas->fetchAll(PDO::FETCH_ASSOC);

foreach($array_banco as $item){
    ###############################################
    $fields[$item['field']] = $item['description'];
}

$array = array (
    'key'       => '8b0dc65f996f98fd178a9defd0efa077',
    'module'    => 'imoveis',
    'method'    => 'busca_imoveis',
    'field'     => $fields
);

$client = new SoapClient(null, array (
    'uri' => 'http://soap.imo.bi/',
    'location' =>
    'http://soap.imo.bi/soap.dll',
    'trace' => 'trace'
    )
);
    
asked by anonymous 28.12.2014 / 17:02

1 answer

3

I think you want to do this:

foreach($array_banco as $item){

    $fields[$item['field']] = $item['description'];

}

This while before foreach does not seem to make any sense. It even works, but by coincidence.

See running on ideone .

    
28.12.2014 / 17:35