Deck 8: Manipulating Mysql Databases With Php
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/84
Play
Full screen (f)
Deck 8: Manipulating Mysql Databases With Php
1
The mysql_delete_db("dbname"[, connection]); script is used to delete a database.
False
2
PHP, you use the mysql_send() function to send SQL statements to MySQL.
False
3
The PHP Extension and Application Representation (PEAR) is a committee that oversees the open source PHP code.
False
4
The first record added to a table that has an auto-incrementing primary key will be assigned a value of 0.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
5
When you add records to a table that includes an AUTO_INCREMENT field, you omit the column name and value from the lists.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
6
How you enable MySQL support in PHP depends on the version of PHP and how you installed MySQL.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
7
The mysqli package is the object-oriented equivalent of the mysql package.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
8
A list of records that are returned from a query is called a resultset.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
9
To prevent code from trying to create a table that already exists, use the SHOW EXISTING TABLES command.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
10
You can suppress error message by using the error control operator (%).
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
11
You can use the mysql_select_db() function to select a database or change to a different database.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
12
The error control operator disables error checking.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
13
The query pointer is a way of keeping track of where you are in a resultset.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
14
One of the most popular PEAR code modules is PEAR DB, which simplifies access between PHP and a database server.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
15
The PRIMARY KEY keywords are used to generate a unique id for each new row in a table.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
16
The mysql_error() function returns a value of FALSE if it detects an error.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
17
To update records in a table, use the UPDATE, SET, and WHERE keywords with the mysql_query() function.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
18
The mysql_connect() function returns a 1 if it connects to the database successfully or 0 if it doesn't.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
19
The mysql_close() function is used to explicitly close a database connection.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
20
The NOT NULL keywords are often used with primary keys to require that a field include a value.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
21
With queries that modify tables, but do not return results, such as INSERT, UPDATE, and DELETE queries, you use the mysql_modified_rows() function to determine the number of changed rows.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
22
The ____ package is designed to work with MySQL version 4.1.3 and higher.
A) mysql
B) mysqli
C) libmysql
D) ext_mysqli
A) mysql
B) mysqli
C) libmysql
D) ext_mysqli
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
23
When you are finished working with query results retrieved with the mysql_query() function, you should use the mysql_free_resultset() function to close the resultset.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
24
You pass the mysql_affected_rows() function the variable containing the result pointer from the mysql_query() function.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
25
To return information about the MySQL database server version, use the ____ function.
A) mysql_get_client_info()
B) mysql_host_info(connection)
C) mysql_get_proto_info(connection)
D) mysql_get_server_info(connection)
A) mysql_get_client_info()
B) mysql_host_info(connection)
C) mysql_get_proto_info(connection)
D) mysql_get_server_info(connection)
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
26
The mysql_fetch_row() function returns the fields in the current row of a resultset into an indexed array and moves the result pointer to the next row.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
27
To close a database connection, use ____.
A) close_connection()
B) mysql_close()
C) mysql_exit()
D) close_mysql()
A) close_connection()
B) mysql_close()
C) mysql_exit()
D) close_mysql()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
28
To delete records in a table, use the DELETE and WHERE keywords with the mysql_query() function.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
29
Almost every command sent to MySQL from PHP is executed with the ____ function.
A) mysql_connect()
B) mysql_select()
C) mysql_send()
D) mysql_query()
A) mysql_connect()
B) mysql_select()
C) mysql_send()
D) mysql_query()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
30
To open a connection to a MySQL database server, use ____.
A) mysql_connect()
B) open_connect()
C) connection_mysql()
D) open_mysql()
A) mysql_connect()
B) open_connect()
C) connection_mysql()
D) open_mysql()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
31
The mysql_info() function returns the number of operations for various types of actions, depending on the type of query.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
32
The mysql_info() function also returns information for LOAD DATA queries.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
33
The mysql_query() function returns a result pointer that represents the query results when the SELECT or SHOW statement which returns a resultset.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
34
The symbol (@), used to suppress error messages, is called ____.
A) supression operator
B) error control operator
C) null operator
D) no_error operator
A) supression operator
B) error control operator
C) null operator
D) no_error operator
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
35
The ___ function returns a text string describing the error in PHP code.
A) mysql_error()
B) mysql_errno()
C) mysql_err()
D) mysql_error_number()
A) mysql_error()
B) mysql_errno()
C) mysql_err()
D) mysql_error_number()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
36
To delete a database, use the ____ function.
A) mysql_delete_db()
B) mysql_drop_db()
C) mysql_delete_database()
D) mysql_drop_database()
A) mysql_delete_db()
B) mysql_drop_db()
C) mysql_delete_database()
D) mysql_drop_database()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
37
You select a database or change to a different database with the ____ function.
A) mysql_select_database()
B) mysql_change_database()
C) mysql_select_db()
D) mysql_change_db()
A) mysql_select_database()
B) mysql_change_database()
C) mysql_select_db()
D) mysql_change_db()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
38
The mysql_fetch_assoc() function returns the fields into an associative array and uses each row name as the array key.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
39
You use the mysql_num_fields() function to return the number of _______________ in a query result.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
40
With queries that return results, such as SELECT queries, you can use the mysql_num_rows() function to find the number of records returned from a query.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
41
A result pointer is a special type of ____ that refers to the currently selected row in a resultset.
A) variable
B) option
C) function
D) command
A) variable
B) option
C) function
D) command
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
42
The mysql_connect() function returns a ____________________ as an integer if it connects successfully to a database or a Boolean FALSE if it doesn't.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
43
Use the ___ function to return the number of fields in a query result.
A) mysql_return_fields()
B) mysql_num_fields()
C) mysql_count_fields()
D) mysql_field_results()
A) mysql_return_fields()
B) mysql_num_fields()
C) mysql_count_fields()
D) mysql_field_results()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
44
When a query modifies a table but does not return a result, you use the ___ function to determine how many rows/records were affected.
A) mysql_rows_affected()
B) mysql_affected_rows()
C) mysql_affected_records()
D) mysql_records_affected()
A) mysql_rows_affected()
B) mysql_affected_rows()
C) mysql_affected_records()
D) mysql_records_affected()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
45
The mysql_info() function only returns query information when you add ___ records with the INSERT keyword.
A) one
B) more than one
C) less than five
D) no records
A) one
B) more than one
C) less than five
D) no records
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
46
To change records in a table, use the UPDATE keyword to specify the name of the table to update and the ___ keyword to specify the value to assign to the fields in the records that match the condition in the WHERE keyword.
A) CHANGE
B) INSERT
C) PUT
D) SET
A) CHANGE
B) INSERT
C) PUT
D) SET
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
47
With an INSERT query, the ___ function returns the number of records added and duplicated along with the number of warnings.
A) mysql_update_info()
B) mysql_info()
C) mysql_update()
D) mysql_info_update()
A) mysql_update_info()
B) mysql_info()
C) mysql_update()
D) mysql_info_update()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
48
The mysqli (____________________) package became available with PHP 5 and is designed to work with MySQL version 4.1.3 and above.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
49
Although they perform similar functions, PEAR DB is designed specifically to work with PHP and ____________________ is a more generic protocol used by many programming languages and database management systems.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
50
The ___ keyword is often used with the primary key to generate a unique id for each new row in a table.
A) UNIQUE_ID
B) INCREMENT_ID
C) AUTO_INCREMENT
D) AUTO_INCREMENT_ID
A) UNIQUE_ID
B) INCREMENT_ID
C) AUTO_INCREMENT
D) AUTO_INCREMENT_ID
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
51
To add multiple records to a database from an external file, you use the ____ statement with the name of the local text file that contains the records you want to add.
A) INSERT DATA
B) LOAD DATA
C) INSERT RECORDS
D) UPLOAD RECORDS
A) INSERT DATA
B) LOAD DATA
C) INSERT RECORDS
D) UPLOAD RECORDS
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
52
To close the resultset, use ____.
A) mysql_close()
B) mysql_kill()
C) mysql_exist()
D) mysql_free_result()
A) mysql_close()
B) mysql_kill()
C) mysql_exist()
D) mysql_free_result()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
53
The ___ keyword, often used with the primary key, requires that the field include a value.
A) NOT NULL
B) NOT BLANK
C) NOT EMPTY
D) NOT VOID
A) NOT NULL
B) NOT BLANK
C) NOT EMPTY
D) NOT VOID
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
54
PEAR stands for ________________________________________.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
55
When mysql_query() returns a resultset, you use the ____ function to determine the number of records in the resultset.
A) mysql_result_rows()
B) mysql_num_result()
C) mysql_num_rows()
D) mysql_num_records()
A) mysql_result_rows()
B) mysql_num_result()
C) mysql_num_rows()
D) mysql_num_records()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
56
The function ____ returns the fields in the current row of a resultset into an associative array and moves the result pointer to the next row.
A) mysql_fetch_lengths()
B) mysql_fetch_assoc()
C) mysql_fetch_rows()
D) mysql_fetch_array()
A) mysql_fetch_lengths()
B) mysql_fetch_assoc()
C) mysql_fetch_rows()
D) mysql_fetch_array()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
57
The function ____ returns the fields in the current row into an indexed array.
A) mysql_fetch_assoc()
B) mysql_data_seek()
C) mysql_fetch_row()
D) mysql_fetch_lengths()
A) mysql_fetch_assoc()
B) mysql_data_seek()
C) mysql_fetch_row()
D) mysql_fetch_lengths()
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
58
The list of records that is returned from a mysql_query() is a called a ____.
A) recordset
B) resultset
C) result
D) result query
A) recordset
B) resultset
C) result
D) result query
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
59
The ____ command with a mysql_query() function executes successfully if the table already exists.
A) SHOW EXISTING TABLE
B) SHOW MATCHING TABLE
C) SHOW SAME TABLE
D) SHOW TABLES LIKE
A) SHOW EXISTING TABLE
B) SHOW MATCHING TABLE
C) SHOW SAME TABLE
D) SHOW TABLES LIKE
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
60
To delete records in a table, use the keywords ____.
A) DELETE, RECORD
B) DELETE, WHERE
C) REMOVE, WHERE
D) REMOVE, RECORD
A) DELETE, RECORD
B) DELETE, WHERE
C) REMOVE, WHERE
D) REMOVE, RECORD
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
61
When adding a record to a table, you can specify ____________________ in any fields for which you do not have a value.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
62
To prevent your code from trying to create a table that already exists, use the ____________________ command.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
63
The mysql_errno() function returns the ____________________ code of an error.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
64
You can suppress error messages in PHP using the _________________________ (@).
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
65
To add multiple records to a database from an external file, you use the ____________________ statement with the name of the local text file that contains the records you want to add.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
66
The first field created using the AUTO_INCREMENT keyword is assigned a value of ____________________.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
67
To create a table, use the ____________________ statement with the mysql_query() function.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
68
If you are connecting to an instance of the MySQL database server that is running on the same server as the PHP scripting engine, use a value of ____________________ or "127.0.0.1" for the host argument.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
69
The ____________________ function is used to select a database or change to a different database.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
70
You pass the mysql_close() function the database ____________________ variable to close the database.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
71
Use the _________________________ function to determine the number of rows affected by an INSERT statement.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
72
To delete a database, you use the ____________________ function.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
73
The ____________________ is a special type of variable that refers to the currently selected row in records returned by MySQL.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
74
In PHP, use the mysql_query() function to send SQL statements to ____________________.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
75
Because the client and server are defined in relation to MySQL, the Web server where the PHP script is running is the ____________________ when communicating with the MySQL server.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
76
Because the ____________________ function exits the script immediately if an error occurs, any further script output is not displayed.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
77
To delete a table, use the ____________________ statement with the mysql_query() function.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
78
The ____________________ function returns the number of rows in a query result.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
79
To delete all the records in a table, you use the DELETE statement but omit the ____________________ keyword.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck
80
The ____________________ function returns the number of rows in a query resultset.
Unlock Deck
Unlock for access to all 84 flashcards in this deck.
Unlock Deck
k this deck