How to save all data from an array into a single variable? example I call a query from a certain column of the database and it generates a while and wanted to in a variable.
Maybe the right one would be to join elements of an array 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