11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CHAPTER 18 • SESSION HANDLERSwww.it-ebooks.infoarticles you read and present you with a list whenever requested? This example demonstrates such afeature.The solution is surprisingly easy, yet effective. To remember which documents have been read by agiven user, you can require that both the user and each document be identified by a unique identifier.For the user, the SID satisfies this requirement. The documents can be identified in any way you wish,but this example uses the article’s title and URL, and assumes that this information is derived from datastored in a database table named articles, displayed here:CREATE TABLE articles (id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,title VARCHAR(50),content MEDIUMTEXT NOT NULL,PRIMARY KEY(id));The only required task is to store the article identifiers in session variables, which is implementednext:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!