1
How to save all data from an array to a single variable ? example I call a query of a determianda column of the bank and Gero a while and wanted to put in a variable.
Maybe the right thing would be to join elements of a matrix into a string?
$sql_lista3 = mysql_query("select * from empresa as c1
inner join empresa_has_viagem as c2 on c1.em_id= c2.empresa_em_id
where viagem_via_id=37 order by viagem_via_id;");
while($resultado3 = mysql_fetch_array($sql_lista3)){
$campanha = array($resultado3['em_nomefantasia']);
};
$resultado = implode(",", $campanha); //essa seria a variavel
What is the purpose of this code?
$nada
should get what? name sounds pretty intuitive :D– rray
actually would be the result @rray
– gezer
vc wants a string delimited by commas that?
– rray
You must receive data from a selected table.
– gezer
That’s right @rray
– gezer
Do so
$campanha[] = $resultado3['em_nomefantasia'];
see if that’s what you want.– rray
that even correct friend thanks my faltering on not for $campaign[] maybe it has been lack of attention rs to sleepless days right kkk Valew bro.
– gezer
To see the structure of an array use
print_r($var)
, always takes away the doubts of how to use it.– rray
Look who had done this and appeared only a company rs then I saw that I had error because it was more of a.
– gezer