Monday, 27 August 2018
Subscribe to:
Post Comments (Atom)
<?php
$con=mysqli_connect("localhost"," "," "," ");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM programari");
$to = "my_email@yahoo.com";
$subject = "testing mail";
while($row = mysqli_fetch_array($result))
{
$body= $row['cand'];
}
if (mail($to, $subject, $body)) {
echo("<p>Email successfully sent!</p>");
} else {
echo("<p>Email delivery failed…</p>");
}
?>
$body
instead of concatenating. Short and sweet:$body .= $row['cand'];
$body
to an empty string before your loop, to avoid a notice on the first run.Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment