2. For this tutorial, i create a "customer database" in MysQL with following database structure:

3. Build your project in PHPRUNNER and generate it.
4. Extract all the PHP QR Code to the root directory of your generated project as you see in screenshot :
Resized to 87% (was 1102 x 362) - Click image to enlarge

5. Create a generated_barcode folder in your project directory
6. In PHPRUNNER, in after record added event, use the following code:
//email_address field name in your database table
$email=$values["email_address"];
//replace email with your own domain
$from="admin@yourdomain.com";
$msg="";
$subject="QR code sample";
$msg.= "Dear \n";
//get customer name from database
$msg.= "<b>".$values["customer_name"]."</b> \n";
$msg.= "This is a sample QR Code.\n";
//include qrlib.php. If you extract qrcode in other directory (not in root of your project), please make change the following line
include "qrlib.php";
//define a directory in web server to store generated QR Code
$myBarcodeDir = 'generated_barcode/';
//Content of the QR Code
$codeContents = $values["customer_id"].$values["customer_name"];
//filename of the generated QR Code (value of customer_id field)
$fileName = $values["customer_id"].'.png';
$pngAbsoluteFilePath = $myBarcodeDir.$fileName;
$urlRelativeFilePath = 'generated_barcode/'.$fileName;
//QR_ECLEVEL_L is parameter of the generated barcode. Please read the QR Code manual for other parameters
QRcode::png($codeContents, $pngAbsoluteFilePath, QR_ECLEVEL_L, 4);
$msg.= "<hr> \n";
$msg.= "<hr> \n";
//send email with generated barcode
$msg.='<img src="'.$urlRelativeFilePath.'" />';
$msg.= "<hr> \n";
//replace cc email with your own email
$ret=runner_mail(array('to' => $email, 'cc' => 'someone@anydomain.com', 'subject' => $subject, 'htmlbody' => $msg, 'from'=>$from));
if(!$ret["mailed"])
echo $ret["message"];
7. Done. Generate your phprunner project and upload generated project to your web server
8. Screenshot of add data:

9. Screenshot of generated QR Code in generated_barcode folder.

10. Screenshot of email received after record added
Resized to 75% (was 1279 x 589) - Click image to enlarge

11. Sory for my poor english

Post a Comment