Home arrow PHP arrow Page 3 - Client Management for a PHP Invoicing System

Deleting clients and viewing their details - PHP

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

Delete Client

Simply deletes a client from the database:

<?
include "config.php";
if(isset($_GET['cid'])){

$query = "DELETE FROM client WHERE id = '".$_GET['cid']."'";
if(mysql_query($query))
{
header("location:allclients.php");

}else{
echo mysql_error();
}

}
?>

View Client Details

Shows the client information, this is done by sending a client id to the cdetails.php page:

<?
include "FCKeditor/fckeditor.php";
include "config.php";
if(isset($_GET['cid'])){
$query_clients = "SELECT * FROM client WHERE id = '".$_GET
['cid']."'";
$result_clients = mysql_query($query_clients);
$num_clients = mysql_num_rows($result_clients);
$clients = mysql_fetch_assoc($result_clients);
}
?>

Once the script receives the client id, it searches for that client and shows it in an HTML table:

<table width="100%" border="0" cellspacing="1" class="block">
        <tr>
          <td colspan="2"><table width="100%" height="19"
border="0">
            <tr class="heading">
              <td width="22%"><a href="Main.php" class="link">
[MENU]</a></td>
              <td width="17%"> <a href="allclients.php">CLIENT
LISTINGS</a> </td>
              <td width="24%">USER:<?=$user;?></td>
              <td width="37%"><a href="logout.php"
class="link">LOGOUT</a></td>
            </tr>
          </table></td>
        </tr>
        <tr>
          <td width="46%"><?=$clients['name'];?> </td>
          <td width="54%">Date Added:<?=$clients['date_added'];?> </td>
        </tr>
        <tr>
          <td><?php
$oFCKeditor = new FCKeditor('address') ;
$oFCKeditor->BasePath = 'FCKeditor/';
$oFCKeditor->Value = $clients['address'];
$oFCKeditor->Create() ;
?></td>
          <td><a href="edClient.php?cid=<?=$clients['id']?
>">Update Details </a></td>
        </tr>
      </table>

There is also a link to update the client information if you so wish.



 
 
>>> 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 10 - Follow our Sitemap

Dev Shed Tutorial Topics: