PHP 5 for Dummies Free Open Book

PHP 5 for Dummies

Previous PageNext Page
Chapter 12
Storing Data with PHP
In This Chapter
Writing and reading flat files
Exchanging data between PHP and other programs
Understanding database support in PHP
Using PHP to interact with a database
Handling database-connection errors
M
any applications require the long-term storage of information. In PHP
scripts, you can make information available within sessions— periods
of time that users spend at your Web site — by using methods such as PHP
session functions and by submitting forms. However, eventually you need to
store information for use tomorrow or next week. You can store it in a cookie
that you set to last after the session is ended (as discussed in Chapter 11), but
the information is vulnerable. It’s not under your control. The user can delete
or change the information at any time or can refuse to accept the cookie. To be
available and stable, the information needs to be stored somewhere secure,
where no one can access or tamper with it. The information needs to be stored
on the server.
Information can be stored on the server in flat files or in databases. Flat files
are text files stored in the computer file system. Humans can read flat files by
using the operating system commands that display files, such as 
cat
in Linux
and Unix. You can access and edit these files by using any text file editor, such
as Notepad or vi. The information in the flat file is stored as strings, and the
PHP script that retrieves the data needs to know how the data is stored. For
example, to retrieve a customer name from a file, the PHP script needs to
know that the customer name is stored in the first 20 characters of every line.
Using a database for data storage requires you to install and learn to use data-
base software, such as MySQL or Oracle. The data is stored in files created by
the database software and can only be accessed by the database software.
Databases can store very complex information that you can retrieve easily.
Previous PageNext Page


     Main Menu
PHP 5 for Dummies
Table of Contents
Introduction
Part I: Say Hello to the PHP Scripting Language
Part II: Variables and Data
Part III: Basic PHP Programming
Part IV: Common PHP Applications
Destroying Objects - Page 215
Chapter 10: The Basics of Web Applications
Chapter 11: Other Web Applications
Chapter 12: Storing Data with PHP
Using PHP variables with JavaScript - Page 264
Using PHP variables with JavaScript - Page 265
Using Flat Files
Working with Databases
Using SQLite
Chapter 13: PHP and Your Operating System
Chapter 14: PHP Extensions
Part V: The Part of Tens
Part VI: Appendixes
Index
Team DDU


More Books
PHP Hacks
Processing Xml With Java - A Guide To Sax, Dom, Jdom, Jaxp, And Trax
The Koran (Holy Qur'an)
Macromedia Flash 8 Bible
Search Engine Optimization for Dummies
YouTube Traffic
PHP 5 for Dummies
Harry Potter and The Chamber of Secrets
Harry Potter and the Sorcerer's Stone
The Pilgrim's Progress
Wireless Hacks
Flash Hacks. 100 Industrial-Strength Tips & Tools
PayPal Hacks. 100 Industrial-Strength Tips and Tools
Amazon Hacks
Pdf Hacks
The Da Vinci Code
Google Hacks
The Holy Bible
Windows XP For Dummies
Harry Potter and the Half-Blood Prince
Seo Book
Upgrading and Repairing Networks
Macromedia Dreamweaver 8 UNLEASHED
Windows XP Annoyances
Windows XP Hacks
Microsoft Windows XP Power Toolkit
Teach Yourself MS Office In 24Hours
iPod & iTunes Missing Manual
PC Hacks 100 Industrial-Strength Tips and Tools
PC Overclocking, Optimization, and Tuning - 2th Edition
PC Hardware In A Nutshell 3rd Edition
PC Hardware in a Nutshell, 2nd Edition
Upgrading and Repairing PCs
Google for Dummies
MySQL Cookbook
Teach Yourself Macromedia Flash 8 In 24 Hours
PHP CookBook
Sams Teach Yourself JavaScript in 24 Hours
PHP5 Manual
Free Games Paper Airplanes
500 Juegos Gratis 500 Giochi Gratis 500 Jeux Gratuits 500 Jogos Gratis 500 Kostenlose Spiele