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