Telu
Telu

Reputation: 5

mysql data to email from php

Shown data from mysql query in php file:

while ($row = mysql_fetch_array($sql)){ 
  echo 'ID: '.$row['ID']; 
  echo ' First Name: '.$row['First']; 
  echo ' Last Name: '.$row['Last']; 
  echo ' Phone: '.$row['Phone'];

}

I need to send those results to email
How to do this? like:

$message = 'ID: '.$row['ID'];

not working: I receive message "ID:" without result

Upvotes: 0

Views: 78

Answers (2)

Teena Thomas
Teena Thomas

Reputation: 5239

You don't have a $to address. Moreover, please remove the @ and don't suppress the errors. Also, check if the $headers are defined.

Upvotes: 2

Davit
Davit

Reputation: 1375

Take a look at PHPMailer Library. It is used by many php developers, it is very easy to use and is powerful as well.

Upvotes: -1

Related Questions