0
Hi Dev I am there some three days trying to work out a way to send data from a table by function mail php. Sending data from just one column is basically easy, but it gets complicated when I want to send data from more than one column.
That’s because I need to make one while to call all data, but how will I send this called data in the body of the function email mail?
In the example below note that the fourth argument of the email function is precisely the variable that contains a set of other variables.
But when the email is submitted only the last element of the variable $html is warrant.
$buscando = mysql_query("SELECT * FROM guardapedidos WHERE id_cliente = '$idDoCliente'")
or die(mysql_error());
while ($linha = mysql_fetch_array( $buscando )) {
$nomeProdutoG = $linha['nomeProdutoG'];
$quantidadeG = $linha['quantidadeProdutoG'];
$precoProdutoG = $linha['precoProdutoG'];
$subTotalG = $linha['subTotalG'];
$totalG = $linha['totalG'];
echo $html = "
<b>Nome</b> $nomeProdutoG.<br>
<b>Quantidade</b> $quantidadeG.<br>
<b>Preço</b> $precoProdutoG.<br>
<hr>
";
}
$envio = mail($destino, $assunto, $html, $headers);
Study on String operators, will help you in your current problem and in future projects.
– user10221
Valdiney France, I’m having a problem sending email with this function, could you tell me how you set up your smtp? Thanks.
– João Neto