Page 475 - Beginning PHP 5.3
P. 475
Chapter 14: Manipulating MySQL Data with PHP
deleteMember() simply creates a new Member object containing just the ID stored in the form ’ s
memberId hidden field, then calls the object ’ s delete() method to remove the member record from
the members table. It also calls the LogEntry::deleteAllForMember() static method, passing in the
member ID, in order to delete any access log entries associated with this member.
Finally, the displaySuccess() function informs the administrator that the update or delete operation
was successful, and provides a link to return to the member list at the point the administrator left off.
It does this by passing the start and order parameters from the form post into the query string in
the link.
Testing the Member Manager
You ’ ve built your member manager, so now it ’ s time to test it. Navigate to your view_members.php
script inside your book_club folder to view the list of members in the database (Figure 14 - 5). Click a
member ’ s username to view and edit their details (Figure 14 - 6). Try entering different values in the form,
then click Save Changes to update the member. You can then click the username again in the members
list to verify that the changes were indeed made. Click Delete Member to remove a member entirely
from the system.
Figure 14 - 5
437
9/21/09 9:14:15 AM
c14.indd 437
c14.indd 437 9/21/09 9:14:15 AM