Source code example for Web Database Applications
Unless otherwise stated, the source code distributed with this book can be
redistributed in source or binary form so long as an acknowledgment appears
in derived source files.
The citation should list that the code comes from Hugh E.
Williams and David Lane, "Web Database Application with PHP and MySQL"
published by O'Reilly & Associates.
This code is under copyright and cannot be included in any other book,
publication, or educational product without permission from O'Reilly &
No warranty is attached; we cannot take responsibility for errors or fitness
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
class BottleCounter extends Counter
// Add 12 bottles to the counter
$this->count += 12;
// Return the number of cases to be shipped
return ceil($this->count / 12);
// A Constructor that sets the initial count
$this->count = $startCount;
// Create a new object of type "BottleCounter"
// and pass the initial count of 12
$temp = new BottleCounter(12);
// Increment the counter
// Add another Case
// Print out the value of the counter: 24
echo "<p>Counter is now: ";
// Print the number of cases
$cases = $temp->caseCount();
echo "<p>The number of cases to ship: $cases";