Exam 2
What is the difference between a text box and a text area?
A text box is a single line, a text area can be multiple lines and wrap text.
How can you ensure that an input is completed before a form gets submitted?
Apply the required attribute to essential inputs.
How can you retrieve a particular row of data from a set of mysqli results?
Call the data_seek method of a mysqli connection object, passing it through the string to be escaped.
How do you connect to a MySQL database using mysqli?
Call the mysqli method, passing the hostname, username, password, and database.
What does the word relationship mean in reference to a relational database?
Connection between two pieces of data that have some association.
How do you submit a query to MySQL using mysqli?
Ensure you have first created a connection object to a database and call its query method passing the query string.
MySQL vs MYSQL database
MySQL is a language, database contain tables.
What is the term for the process of removing duplicate data an optimizing table?
Normalization
How can you determine the number of rows returned by mysqli query?
Num_rows
How can you submit a form field without displaying it in the browser?
Place it in a hidden field using the attribute type= "hidden"
What commands initiate and end a MySQL transaction?
Start: BEGIN or START TRANSACTION Cancel: ROLL BACK End: COMMIT
SQL
Structured Query Language
You can submit form data using either the POST or the GET method. Which associative arrays are used to pass this data to PHP?
The associative arrays used to pass submitted for data to PHP are $_Get for the get method and $_POST for the post method.
Field
The name of each column or field within a table
What do you put in a column to tie together two tables that contain item having a one-to-many relationship?
The primary key from the table on the "one" side must be added as a separate column (a foreign key) to the table on the "many" side.
What is the purpose of the semicolon in MySQL queries?
To separate or end commands
How can you view the structure of a table?
Type describe tablename
Which command would you use to view the available databases or tables?
Type show databases, to see tables type show tables
How can you submit a group of selections from a web form using a single field name?
Use an array name with square brackets such as choices[ ]. Each value is then placed into the array, whose length will be the number of elements submitted.
If a form has to offer three choices to a user, each of which is mutually exclusive so that only one of the three can be selected, which input type would you use, given a choice between checkboxes and radio buttons?
Use radio buttons because checkboxes allow multiple selections.
Which HTML tag is used to encapsulate a form element and supporting text or graphics, making the entire unit selectable with a mouse-click?
Use the <label> and </label> tags
VARCHAR
Variable length character string, command takes a numeric value that tells mySQL the maximum length allowed for a string stored in this field
How can you create a database with a many-to-many relationship?
You create an intermediary table containing keys from two other tables. The other tables can reference each other via the third.
Foreign key
a key used to link two tables together, can refer to the primary key in another table
Database
a structured collection of records or data stored in a computer system and prganized in a way that can be easily searched
table
a subcontainer within a database that stores the actual data
1NF (First Normal Form)
all columns contain a single value, a primary key, no repeating columns containing the same kind of data
Create a new user
click on user accounts
3NF (Third Normal Form)
it is in the second normal form, it doesn't have transitive dependency
Composite key
more than one column is used to specify the primary key of the table
Mysqli procedurally
provides a procedural interface as well as an object oriented interface
Normalization
separating data into tables and creating primary keys. The goal each piece of data appears in the table only once.
2NF (Second Normal Form)
should be in the first normal form, should not have partial dependency
How do you create a new table?
type create table table_name
Primary key
uniquely identifies each record in a table, primary keys must be unique values