This topic is locked
[SOLVED]

 Populate email fields with values from database

3/21/2019 3:39:38 AM
PHPRunner General questions
C
CTom author

Hello,
I am trying to use a button in order to send emails to several users using for subject and body values stored in the database. I have tried various type of syntax without success so any help here would be highly appreciated.
$subject = "Employee: ".$data["':USERS.Name'"]. " ID: ".$data["USERS.UID"]."\n"; // this is sending nothing

$body = "Message text hardcoded"; // this is being sent
Thank you in advance for any hint/advice.
C

C
cristi 3/21/2019

First of all are you sure that it is ":USERS.Name"??? Maybe that ":" does not belong there...

C
CTom author 3/21/2019



First of all are you sure that it is ":USERS.Name"??? Maybe that ":" does not belong there...


Right about : <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=87396&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' /> thanks for pointing this, it still does nothing, I guess that it is more than inserting a db field(in fact that was the info I needed) ... more something like querying the database.
Thanks anyway.

C
cristi 3/21/2019

Here is a working example from one of my databases - maybe you can use this for inspiration:

$email="email@email.com";

$from="email@email.com";

$msg="A new data file was submitted for the Database from ";

$subject="New data submission Database";
$msg.= "Name: ".$values['Name']."\r\n";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];
admin 3/21/2019

If you use a button you need to refer to PHPRunner manual that applies to buttons:
https://xlinesoft.com/phprunner/docs/inserting_button.htm#examples
For instance in a first example you can see that you need to use $button->getCurrentRecord() in order to access data of underlying record.

C
CTom author 3/22/2019



If you use a button you need to refer to PHPRunner manual that applies to buttons:
https://xlinesoft.com/phprunner/docs/inserting_button.htm#examples
For instance in a first example you can see that you need to use $button->getCurrentRecord() in order to access data of underlying record.



Hello,
Thank you very much for your answers, these have answered perfectly to my initial question(inserting a database field and the syntax to use).
Catalin