Home > Articles > Programming > PHP

  • Print
  • + Share This
This chapter is from the book



  1. What function would you use to open a database using the DBA functions?

  2. What function would you use to insert a record into a database?

  3. What function would you use to replace a record in a database?

  4. How would you access a record from a database by name?

  5. How would you get the name (as opposed to the value) of the first element in a database?

  6. How would you get subsequent element names?

  7. How would you delete a named element from a database?

Quiz Answers

  1. You can open a database with the dba_open() function.

  2. The dba_insert() function adds a record to a database.

  3. The dba_replace() function replaces a record in a database.

  4. The dba_fetch() function returns an element given a DBA resource and the element's name.

  5. dba_firstkey() returns the name of the first element in a DBM-like database.

  6. After calling dba_firstkey(), you can get subsequent element names by calling dba_nextkey().

  7. You can delete an element with dba_delete().


  1. Create a database to keep track of user names and passwords. Create a script that allows users to register their combinations. Don't forget to check for duplications.

  2. Create an authentication script that checks a user name and password. If the user input matches an entry in the database, present the user with a special message. Otherwise, re-present the login form to the user.

  • + Share This
  • 🔖 Save To Your Account