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
escort Bursa Bursa escort Antalya eskort
   

PHP ARTICLES

- 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: