Chapter 10 - Accessing MySQL Flashcards

1
Q

What is the standard PHP function for connecting to a MySQL database?

A

The standard MySQL function used for connecting to a MySQL database is mysql_connect.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

When is the mysql_result function not optimal?

A

The mysql_result function is not optimal when more than one cell is being requested, because it fetches only a single cell from a database and therefore has to be called multiple times, whereas mysql_fetch_row will fetch an entire row.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Give one reason why using the POST form method is usually better than GET.

A

The POST form method is generally better than GET, because the fields are posted directly, rather than being appended to the URL. This has several advantages, particularly in removing the possibility to enter spoof data at the browser’s address bar. (It is not a complete defense against spoofing, however.)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you determine the most recently entered value of an AUTO_INCREMENT column?

A

To determine the last entered value of an AUTO_INCREMENT column, use the mysql_insert_id function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which PHP function escapes a string, making it suitable for use with MySQL

A

The PHP function that escapes characters in a string, making it suitable for use with MySQL, is mysql_real_escape_string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which function can be used to prevent XSS injection attacks?

A

The function htmlentities can be used to prevent cross-site scripting injection attacks.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly