Web Design

(Nancy Kaufman) #1

307


CHAPTER

Adding Information from a Database 13


What does the MYSQL_ASSOC command do?
When you call the mysql_fetch_array
function, it can create the array of the data using
either the field names or arbitrary numbers. The
MYSQL_ASSOC command tells the function to create
the array using the field names, which are obviously
easier to remember.

Why do I need to type the period and the space
in the quotes when I output the data?
PHP uses a period for concatenating, or combining,
text strings. A space in quotes adds a literal space.
Without this code after the $row[] calls, each
piece of data would run into each prior piece.

● When viewed in a Web
browser, the page displays
the information from the
database.

$ Type }.


% Type ?>.


^ Save the page in the Web
server’s root directory.


15


14


TIPS

Free download pdf