Chapter 3 Review:

What are the benefits to storing session data in a database instead of the file system? (See page 82.)

Sessions in a dbase are potentially more secure and will allow options for scaling.

What PHP function is invoked to change how sessions are handled? (See page 84.)

set_session_save_handler() with callbacks will define new session management behavior.

What do you have to do differently in your other session-related PHP scripts when storing session data in the database? (See pages 91 and 94.)

You should also call session_write_close() before redirecting the browser with a header() call. This only applies when you’re using your own session handlers.

How do you import CSV data into a database table? (See page 98.)

Can be done in SQL - using:

LOAD DATA INFILE '/tmp/ZIP_CODES.txt'
INTO TABLE zip_codes
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

What are stored functions? How do you create them? (See page 108.)

Stored functions are a menas of quickly accessing a set of computations/instructions within SQL - only recently supported by Mysql (ver 5?).

How do you change the delimiter used by the mysql client? Why is that sometimes necessary? (See page 109.)

Assing a new Delimiter to be something other than ; by using DELIMETER $$ (for instance). A short term change of delimiter is necessary in mysql so you can create multi line instructions without immediate and premature execution of code.

Toggle Sidebar