PHP database result sent to function

IM trying to send my Database query result to Mailgun Function, Im not pro in PHP but looking for help: Check below e.g code
As of now IM successful to echo the required output from DB


$query = “SELECT * FROM messages WHERE sent=’0′”;
$result = mysql_query($query);

echo “<table>”; // result
while($row = mysql_fetch_array($result)){ //Creates a loop to loop through results
echo “<tr><td>” . $row[‘id’] . “</td><td>” . $row[‘name’] . “</td><td>” . $row[’email’] . “</td></tr>”;
echo “</table>”; //Close the table in HTML

// On success send data to function

Mailgun code:

function sendMailgun($data){
$api_key = ‘key-XXXXX’;
$api_domain = ‘’;
$send_to = ‘’;

// form data
$name = $_POST[‘name’];
$postcontent = $_POST[‘message’];
$reply = $_POST[’email’];
$Image = $_POST[‘imgId’];
$rName = $_POST[‘senderName’];

etc other code goes below…

how can I send the data to function?

Read more here:: PHP database result sent to function

Leave a Reply

Your email address will not be published. Required fields are marked *