CS222 Assignment 10: PHP, MySQL, JSON


Instructor: Trish Cornez





Part I: Questions about PHP and MySQL


Answer the following questions. Place your answers in a Word document and upload it to Canvas.

  1. Describe the parameters and objectives of the PHP functions strstr() and stristr().
    Explain the difference(s) between the two.
  2. What is a Database schema?
  3. The DML stands for the Data Manipulation Language of MySQL.
    Describe the objective of each of the following DML commands.


  4. Describe the parameters and objectives of the PHP functions explode() and split().
    Explain how these functions are similar and how they differ.
  5. The following are regular expression functions for examining and modifying text in PHP.
      (a) Describe the objective of each function.
      (b) List the required parameters for each function.
      (c) For each function, provide a specific example to illustrate the usage and resulting output.




  6. Assume the following MySQL database exists: Schema and data records.





      (a)Write a SELECT query to list all rows for columns name and price


      (b) Write a SELECT query to list all rows where quantity is less than or equal to 2000. Include the columns for name and quantity.




Part II: Build a Culinary Quiz App

  1. Build the PHP and JavaScript driven Culinary Quiz App shown in the mockup below.
  2. The web app relies on a text file containing a culinary term, a culinary category for the term, and a definition.
  3. Allow the user to specify a culinary category in which to build a quiz question.
  4. Build the question by opening the text file and randomly selecting a term. Select three possible definitions from the text file and build a multiple-choice button selection. Respond "correct" or "incorrect" to all button selections.
  5. Use JSON to pass data between PHP and JavaScript.
  6. Verify the functionality of the App and upload your PHP file(s) to Canvas.



Use the following data file for your food content: assign11.txt