I have a database with dynamic columns that can one hour appear, another time not ... also more columns can be added or even extracted ones that already exist.
I made a code that allows me to capture these columns in my database in real time and now I need to make these columns appear in another part of the code:
<?php
require("setup_do_banco.php");
$colunas = $pdo->prepare("SHOW COLUMNS FROM imovel");
$colunas->execute();
###### Aqui tenho todos as colunas do meu banco de dados
while ( $coluna = $colunas->fetch() ) {
$coluna = $coluna["Field"]; echo "$coluna <br />";
}
$array = array (
'key' => '8b0dc65f996f98fd178a9defd0efa077',
'module' => 'imoveis',
'method' => 'busca_imoveis',
'field' => array (
////////////////////////////////
# <------------
////////////////////////////////
)
);
$client = new SoapClient(null, array (
'uri' => 'http://soap.imo.bi/',
'location' =>
'http://soap.imo.bi/soap.dll',
'trace' => 'trace'
)
);
$res = $client->get($array);
echo "<pre>"; print_r($res); echo "</pre>";
?>
As you can see, through a loop I retrieved all the columns from my database and now I need to plant them inside the arrow field with comma at the end and line break. I tried putting the loop inside the array but it did not work.
How do I put the columns of my bank there in place of the arrow?