Chapter 10 Answers
The standard MySQL function used for connecting to a MySQL database is
mysql_connect.The
mysql_resultfunction 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_rowwill fetch an entire row.The
POSTform method is generally better thanGETbecause 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_INCREMENTcolumn, use themysql_insert_idfunction.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
htmlentitiesfunction.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access