CSCI 2006 - Spring 2024 - Server-Side ProgrammingLab #8 - DBMS MODIFICATION

Lab #8 - DBMS MODIFICATION

Purpose: Interact with a DBMS II

Instructions

  1. We will now be implementing a modification and insertion page for our languages website
  2. The host for accessing the database is localhost (because your script and the database are located on the same server)
  3. The username for accessing the databases used in this course is: csci2006
  4. The password for accessing the databases used in this course is: 9TfP4lxsxH1szKuA
  5. The database name is: csci2006_languages
  6. Copy your (or the key) Lab #7 solution as a base for Lab #8
  7. Add an edit link to the bottom of each page, such that the link will bring the user to a page with a form to enable editing the information related to a programming language
  8. Add a link in the footer to enable the user to go to the same form page, but this time to create a new language page, rather than editing a current one
  9. Modify your Language class to add a function "getEditor" which will create HTML form fields for editing the langauge. Please utilize the HTML/CSS/JavaScript from the example site to produce this form
  10. Ensure that your form is pre-filled with values if editing an existing language, and not pre-filled if creating a new language
  11. Capture the submitted input and prepare it for executing database queries to modfiy the database
  12. If you need help understanding how any of these queries work, please ask the instructor
  13. The SQL you will need to make modifications to the database are as follows:
  14. Add a new language:
    INSERT INTO `language`
      (`language_slug`,`language_name`,`language_example`,`language_highlighter`)
      VALUES (?, ?, ?, ?)
  15. Edit a language:
    UPDATE `language`
      SET `language_slug`=?,
          `language_name`=?,
          `language_example`=?,
          `language_highlighter`=?
      WHERE `lang_id`=?
  16. Add a new description paragraph:
    INSERT INTO `description`
      (`desc_lang`,`desc_ordinal`,`desc_paragraph`)
      VALUES (?, ?, ?)
  17. Edit a description paragraph:
    UPDATE `description`
      SET `desc_paragraph`=?
      WHERE `desc_lang`=?
        AND `desc_ordinal`=?
  18. Remove a description paragraph:
    DELETE FROM `description`
      WHERE `desc_lang`=?
        AND `desc_ordinal`=?
  19. When working with your descriptions, you may find that you need this query as well
    SELECT `desc_ordinal`, `desc_paragraph`
      FROM `description`
      WHERE `desc_lang`=?
      ORDER BY `desc_ordinal`
  20. Test your editing form to ensure that it is properly executing the different SQL code based on the form you submit. Note that the database will periodically reset itself to the original dataset (a database would not normally do this, but since we are all sharing the same dataset, it will be reseting to provide a more consistent starting point for all students)
  21. Upload your PHP file(s) (if you have not been doing that to test your code as you go), to the remote server. Place the file in "public_html/csci2006/lab08/
  22. In a web-browser, go to the URL below

Submitting Instructions