Home arrow PHP arrow Page 3 - User Management in a PHP Invoicing System

Emailing reminders - PHP

In this fourth and final article covering the creation of a PHP invoicing system, we're going to put together the user management section. In this section we will be able to view all available users and do all the associated things like deleting or updating user details. We are also going to be able to add new users.

  1. User Management in a PHP Invoicing System
  2. The Action column
  3. Emailing reminders
  4. User settings page
By: Leidago
Rating: starstarstarstarstar / 6
September 27, 2006

print this article



When a invoice remains unpaid for a set amount of time you can send an email as a reminder to the client. This option is available when you view the list of unpaid invoices. So, create a new PHP document and save it as emailInv.php. Then add the following code:

Code 8 emailInv.php

include "config.php";
$query="SELECT email FROM client where id='".$u_id."'";
$result1 = mysql_query($query);
            if (!$result1) {
               $error = mysql_error();
while ($row = mysql_fetch_array($result1)) {
$em= $row["email"];
$query="SELECT * FROM invoices where invno='".$u_id."'";
 while ($row = mysql_fetch_array($results)) {
$query_invdetails = "SELECT * FROM clientinv WHERE finv='".$invNo'";
if(!$result_invdetails= mysql_query($query_invdetails)){
echo mysql_error();
$num_invdetails = mysql_num_rows($result_invdetails);
$subj="RE: Overdue Invoice Reminder.";
$mess="Product Description: $invdetails['descr']crn";
$mess .="Invoice Number: $invNorn";
$mess .= "Invoice Date: $dtern";
$mess .="Total (incl. VAT): $invdetails['totwVAT']rn";
$mess .="If you have any queries or problems please do not hesitate to contactrn";
$mess .=" your@emailaddress ";
$from=" your@emailaddress
$to=$em ;//Client email address
if (mail($to,$subj,$mess,$from)){
echo "Could not send mail. Please check your mail settings";

A client ID is sent to this script from the unpaid.php page and is then used to retrieve the email address and other information of the client. The script runs three queries; each of them retrieves data related to a particular invoice. The first query interrogates the client table and retrieves the client email address. The second query retrieves the invoice number and the date of the invoice. And finally, the third query retrieves the invoice description and cost.  This information is then used to create an email message, and then sent off.  

>>> More PHP Articles          >>> More By Leidago

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: