Chapter 10 Answers
The standard MySQL function used for connecting to a MySQL database is
mysql_connect
.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, whereasmysql_fetch_row
will fetch an entire row.The
POST
form method is generally better thanGET
because the fields are posted directly, rather than appending them 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.)To determine the last-entered value of an
AUTO_INCREMENT
column, use themysql_insert_id
function.The PHP function that escapes a string, making it suitable for use with MySQL, is
mysql_real_escape_string
.Cross-site scripting injection attacks can be prevented using the
htmlentities
function.
Get Learning PHP, MySQL, JavaScript, and CSS, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.