Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
15 Cards in this Set
- Front
- Back
- 3rd side (hint)
Before you can access and work with data in a database, you must create a connection to the database. In PHP, this is done with what function?
|
mysql_connect()
|
|
|
What is the syntax for mysql_connect()?
Note: There are more available parameters, but the three listed in this answer are the most important. |
mysql_connect(servername,username,password);
|
Note: There are more available parameters, but the three listed in this answer are the most important.
|
|
Using this PHP command to connect to a database, which of the three parameters is mandatory?
mysql_connect(servername,username,password); |
None of the three are. Each is optional.
|
|
|
Using the function mysql_connect(servername,username,password); to connect, what do the parameters do and what is the default should they not be specified?
|
servername - Specifies the server to connect to. Default value is "localhost:3306"
username - Specifies the username to log in with. Default value is the name of the user that owns the server process password - Specifies the password to log in with. Default is "" |
|
|
The connection to the database will be closed as soon as the active script ends. To close the connection before, use the ___________() function.
|
mysql_close()
|
|
|
To get PHP to execute a statement we must use the ___________() function. This function is used to send a query or command to a MySQL connection.
|
mysql_query()
|
|
|
Using the mysql_query() function, what command (what syntax) is used to create a new database?
|
CREATE DATABASE database_name
|
|
|
Using the mysql_query() function, what command (what syntax) is used to create a new table in a database?
|
CREATE TABLE table_name
( column_name1 data_type, column_name2 data_type, column_name3 data_type, ....... ) |
|
|
What are the 5 numeric data types associated with integers (non-decimal)?
Note: The maximum number of digits can be specified in the size parameter |
int(size)
smallint(size) tinyint(size) mediumint(size) bigint(size) |
|
|
What are the 5 numeric data types associated with decimals?
Note: The maximum number of digits can be specified in the size parameter. The maximum number of digits to the right of the decimal is specified in the d parameter. |
decimal(size,d)
double(size,d) float(size,d) |
|
|
What are the 6 textual data types?
|
char(size) - Holds a fixed length string. The fixed size is specified in parenthesis
varchar(size) - Holds a variable length string. The max size is specified in parenthesis tinytext - Holds a variable string with a max length of 255 characters text or blob - Holds a variable string with a max length of 65535 characters mediumtext/mediumblob - Holds a variable string with a max length of 16777215 characters longtext/longblob - Holds a variable string with a max length of 4294967295 characters |
|
|
What is the syntax for one of the date data types?
Note: there are 4 date data types. |
date(yyyy-mm-dd)
datetime(yyyy-mm-dd hh:mm:ss) timestamp(yyyymmddhhmmss) time(hh:mm:ss) |
|
|
enum(value1,value2,ect)
ENUM is short for ENUMERATED list. Can store one of up to 65535 values listed within the ( ) brackets. What happens if you try and insert a value into the table column that is not in the list? |
If a value is inserted that is not in the list, a blank value will be inserted instead.
|
|
|
True or False: The primary key field is never indexed.
|
False. The primary key field is always indexed. There is no exception to this rule!
|
|
|
What does the primary key do?
|
A primary key is used to uniquely identify the rows in a table.
Each primary key value must be unique within the table. Furthermore, the primary key field cannot be null because the database engine requires a value to locate the record. |
|