PHP and MySQL Web Development - P122: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | Implementation 577 Listing Continued headline story_text page writer created modified values headline story_text page . HTTP_SESSION_VARS auth_user . time time result mysql_query sql conn if result print There was a database error when executing pre sql pre print mysql_error exit if isset HTTP_POST_FILES picture name is_uploaded_file HTTP_POST_FILES picture tmp_name if isset story story mysql_insert_id type basename HTTP_POST_FILES picture type switch type case jpeg case pjpeg filename pictures move_uploaded_file HTTP_POST_FILES picture tmp_name filename sql update stories set picture filename where id story result mysql_query sql conn break default print Invalid picture format . HTTP_POST_FILES picture type header Location . HTTP_POST_VARS destination The delete story link calls which actions a simple DELETE statement and returns the writer to the calling code for is shown in Listing . 578 Chapter 26 Building a Content Management System Listing delete Is Used to Delete a Story from the Database php include conn db_connect story HTTP_GET_VARS story sql delete from stories where id story result mysql_query sql conn header Location . HTTP_SERVER_VARS HTTP_REFERER Searching Clicking the keywords link on the stories list brings up a new form for entering keywords against the story. There is no limit to the number of keywords that can be entered and each keyword is given a weight value with a higher value indicating that it is more relevant. Figure shows the screen used to set keywords against a particular story. Figure Setting keywords for a story. Implementation 579 The script is fairly straightforward so we won t look at it in any detail. It is included on the CD-ROM. This script triggers the and scripts are also straightforward and are therefore not included here. The script .