Chapter 13. Ten Things You Might Want to Do Using PHP Functions
In This Chapter
Finding out about many useful functions
Understanding what functions can do
One of the strongest aspects of PHP is its many built-in functions. In this chapter, I list the PHP functions that I use most often. Some of them I describe elsewhere in this book, some I mention only in passing, and some I don't mention at all. The PHP language has many hundreds of functions.
Tip
For a complete list of PHP functions, see the PHP documentation at www.php.net/manual/en/funcref.php
.
Communicate with MySQL
PHP has many functions designed specifically for interacting with MySQL. I describe the following MySQL functions thoroughly in this book:
mysqli_connect(); mysqli_fetch_assoc() mysqli_num_rows(); mysqli_query()
The following functions could be useful, but I either don't discuss them or discuss them only briefly:
mysqli_insert_id($cxn)
: For use with anAUTO-INCREMENT
MySQL column. This function gets the last number inserted into the column.mysqli_select_db($cxn,$database)
: Selects a database. The currently selected database is changed to the specified database. All succeeding queries are executed on the selected database.mysqli_fetch_row($result)
: Gets one row from the temporary results location. The row is put into an array with numbers as keys.mysqli_affected_rows($result)
: Returns the number of rows that were affected by a query — for instance, the number of rows deleted or updated.mysqli_num_fields($result)
: Returns ...
Get PHP and MySQL® For Dummies®, 4th 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.