1
I need to make a query in my Mysql database and store all rows that are returned within the variable $dadosBrutos
. The intention is that each line be separated by the character "§", for example: nomeCliente1,telefoneCliente1§nomeCliente2,telefoneCliente2§nomeCliente3,telefoneCliente3
and so on.
The data will be obtained with the command SELECT * FROM tbClientes
, but I have no idea how to separate one line from the other and store them within the variable $dadosBrutos
.
I tried to make this code with Do...While
, but I have no idea how to continue.
For now I have the following code:
if($qtdeClientesCadastrados > 0) {
$contador = 0;
do {
} while ($contador < $qtdeClientesCadastrados);
} else {
echo "zero_clientes_cadastrados";
}
Remarks:
The variable
$qtdeClientesCadastrados
has already been stated in the above section of the posted code and stores the amount of customers who are registered in thetbClientes
of the database;The whole system of connection to the database is already created and working properly;
If there is any better method to make the code other than with the
Do...While
, also serves, as long as in the end it is possible to give the commandecho $dadosBrutos;
.
The problem is separating with this character
§
– user60252