Page 476 - Beginning PHP 5.3
P. 476

Part III: Using PHP in Practice






































                Figure 14 - 6



                  Summary

                   This chapter concluded the three - chapter series on building database - driven applications with PHP and
                 MySQL. Whereas the last chapter concentrated on reading data from MySQL databases, in this chapter
                 you learned how to alter MySQL data.

                   First you explored the SQL   INSERT ,  UPDATE , and  DELETE  statements and learned how to execute these
                statements from within your PHP scripts using PDO.

                  The rest of the chapter concentrated on practical examples, showing you how to use PDO to manipulate
                MySQL data:

                   ❑       First you wrote a script that allows new members to register for your fictional book club
                       database. This involved adding some utility functions to your common code file, creating
                       methods in your   Member  class to insert a member and check if a username or email address is
                       already taken, and, finally, creating the registration script itself. This script displays the
                       registration form and handles submissions from the form, checking the form data and, if valid,
                       adding the member to the   members  table  .


              438





                                                                                                      9/21/09   9:14:16 AM
          c14.indd   438
          c14.indd   438                                                                              9/21/09   9:14:16 AM
   471   472   473   474   475   476   477   478   479   480   481