Chapter 15: E-campaign System 531 If the database (1 on 1 web hosting)
Chapter 15: E-campaign System 531 If the database is successfully updated, the modifyList() method calls takeMap() to show the database and personalization field map interface. If the update fails, it shows an appropriate status message. modifyDatabaseFieldMap() This method uses a list object to call its modifyMapList() method to update the map data in the database. The map interface is displayed by the takeMap() method. delList() This method uses a list object to call its deleteList() method to delete the list. It displays an appropriate status message based on the success or failure of the deleteList() method. takeMap() This method allows you to map the database fields to the standard personalization fields REC_ID, EMAIL, FIRST, LAST, AGE, INCOME, and SEX. It works as follows: . It connects to the list database using a DBI object called $dbiObj. . If the connection to the list database is successful, it performs a select query to detect if the list table exists in the list database. If the table does not exist, the list is deleted from the database. . If the table exists, the takeMap() method uses the tableInfo() method on the query result object, $result, to get the list table s meta data field name and type. . Then it shows an interface that allows the user to map each standard personalization field to a database field. The user must map at least REC_ID (record ID) and the EMAIL (email address). addList() This method is called when a user makes changes in the add interface shown by displayAddListMenu(). It works as follows: . First, it checks to see if the user supplied all the required fields: list name ($listname), database host name ($db_host), database user name ($db_user), database type ($db_type), database table name ($db_table). If these fields are empty, then an alert message is shown and the user is returned to the previous screen. . If the required fields are supplied, a list object called $ecampaignListObj is created and its addNewEcampaignList() is called to add the list in the database.