Home arrow PHP arrow Page 5 - Time Is Money (part 2)

...And Out - PHP

In this concluding article, explore the scripts which add andremove timesheet entries to the system, and get a crash course instatistics by using these entries to generate useful resource allocationand usage reports.

TABLE OF CONTENTS:
  1. Time Is Money (part 2)
  2. Getting Creative
  3. Split Personality
  4. In...
  5. ...And Out
  6. The Number Game
  7. Exercising Restraint
  8. The Big Picture...
  9. ...And The Little Brush Strokes
  10. When Things Go Wrong
  11. Happy Endings
By: The Disenchanted Developer, (c) Melonfire
Rating: starstarstarstarstar / 4
November 16, 2001

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
The opposite of "add.php" is "delete.php", which is designed to accept a list of record identifiers and delete the corresponding records from the "log" table. An array of these identifiers is passed to the script via the $lid array - take a look:

<? // delete.php - delete timesheet entries // includes and checks // open connection to database $connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!"); // iterate through checkbox array, delete records for ($x=0; $x<sizeof($lid); $x++) { $query = "DELETE FROM log WHERE lid = '$lid[$x]'"; $result = mysql_db_query($database, $query, $connection) or die ("Error in query: $query. " . mysql_error()); } // close connection mysql_close($connection); // redirect back header("Location:view.php?d=$d&m=$m&y=$y"); ?>
Here too, once the deletion has been accomplished, the user is taken back to the originating instance of "view.php"

 
 
>>> More PHP Articles          >>> More By The Disenchanted Developer, (c) Melonfire
 

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

Dev Shed Tutorial Topics: