Home arrow PHP arrow Client Management for a PHP Invoicing System

Client Management for a PHP Invoicing System

What's an invoicing system that can't manage the data for the clients you're invoicing? This article, the third of four parts, shows how to make managing your clients easy. This part of the system allows you to view a full list of client names, and add, update or remove clients from your database.

TABLE OF CONTENTS:
  1. Client Management for a PHP Invoicing System
  2. Building a table
  3. Deleting clients and viewing their details
  4. Updating client information
  5. Adding a new client
By: Leidago
Rating: starstarstarstarstar / 15
September 20, 2006

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

It is up to you how much information about clients you want to keep. As far as this article is concerned, I will only keep the information that is needed to run an invoice system. The obvious information to store about clients is name, address, email, phone number and of course the date that you started working with the client. You are very limited in what you can do with client information, in fact the few things you can do are add a new client, and remove, update, and view client data. 

So let's create a table that will reflect this information:

CREATE TABLE `client` (
  `id` int(4) unsigned zerofill NOT NULL auto_increment,
  `name` varchar(100) NOT NULL default '',
  `address` text NOT NULL,
  `date_added` date NOT NULL default '0000-00-00',
  `email` varchar(100) NOT NULL default '',
  `contact_name` varchar(100) NOT NULL default '',
  `phone_no` varchar(60) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=12 ;

Simply copy and paste the above code into your MySQL clients' SQL window and run the SQL. Once the table has been created and it's all working, create a new PHP document and save it as "allclients.php." This page will list all the clients in the database. At the very top of the page, add the following code:

Code7 allclients.php

<?
include "config.php";
$query_clients = "SELECT * FROM client ORDER BY id DESC";
$result_clients = mysql_query($query_clients);
$num_clients = mysql_num_rows($result_clients);
?>

The above code simply retrieves all the client data from the database. The retrieved number of rows is stored in the "$num_clients" variable.



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

blog comments powered by Disqus
   

PHP ARTICLES

- 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...
- PHP: Building Concrete Validators
- Sanitizing Input with PHP
- Executing Shell Commands with PHP
- Handling File Data with PHP
- File Security and Resources with PHP
- ArrayObject PHP Class Examples
- ArrayObject PHP Class: An Introduction
- Getting File System Data with PHP
- PHP Tools for Working with the File and Oper...
- Working with the File and Operating System w...
- PHP Proxy Patterns: Completing a Blog


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap

Dev Shed Tutorial Topics: