WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this Article to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES SUBMIT AN ARTICLE PRINT
Title : Working With Text Files in PHP
Categories : PHP, Filesystem
devarticles
devarticles
Date : 2002-12-19
Grade : 0 of 5 (graded 0 times)
Viewed : 5914
Search : More Articles by devarticles
Action : Grade This Article
Tools : My Favotite Articles


Submit your own code examples 
 


Introduction

We've come a long way since "back in the day" when it was the "in-thing" to work with flat-files to store application data. Back then (let's say early 1990's) it was popular to save records in CSV formatted plain text files, separated by new lines.

In 1992 I was 10 and was happily plugging away in Microsoft QBasic, trying to build my first ASCII based game by saving high scores and level data into a plain-text file. It worked, but I wish MySQL was around back then!

Today in late 2002, things are a lot different.

Flat files are out and databases are in. I have worked with SQL Server, Access and Oracle, but talking as a software developer, I would have to say that MySQL is the mother of all databases. It's small. Fast. Sleek. Cross-platform. Easy to learn and gets the job done.

I love databases, but I also think that every developer should at least have some basic knowledge of how to read and write files. You may be thinking "why would I need to use flat files. If I use files they're written in XML and I just use a parser to get what I want". Well, here are a couple of reasons why you might need to work with files:


  • To move binary data (such as image files) into a database as BLOBs (Binary Large Objects)
  • To import data (such as email addresses) that has been exported from a legacy database or application.
  • To export data out of a database into a text file so that it can be processed offline


There are hundreds more reasons, many of which I'm sure you've already thought about. Anyway, today I want to run you through some basic file operations with PHP. File functions in PHP are very similar to those found in the C++ fstream library, so if you've come from a C++ background and haven't dabbled with files in PHP just yet, then you're in for an easy ride.

Read More...









Multiple pages of data from a text file
Categories : PHP, Filesystem
File And Directory Manipulation In PHP (part 2)
Categories : PHP, Filesystem, Directories
PHP 101 Part 5 of 15 : Rank And File
Categories : PHP, Beginner Guides, Filesystem
10 PHP Functions I Bet You Didn`t Know About
Categories : PHP, PHP Functions, Filesystem, Arrays, Errors and Logging
File And Directory Manipulation In PHP (part 1)
Categories : PHP, Directories, Filesystem
A Useful Event Calendar Written In PHP
Categories : PHP, Date/time, Calendar
Saving Images in MySQL
Categories : MySQL, PHP, Graphics, Databases
PHP References Explained
Categories : PHP References, PHP
Database Abstraction with PEAR
Categories : PHP, Pear, Databases
Aspect-Oriented Programming and PHP
Categories : PHP, Aspect Oriented Programming
How To add paging (Pagination) with PHP and MySQL
Categories : PHP, Beginner Guides, Databases, MySQL, HTML and PHP
Simple Connection to Oracle with PHP
Categories : PHP, Oracle, Databases
PHP Classes And Objects: A Guide To Development
Categories : PHP, PHP Classes, Object Oriented, Beginner Guides
Custom Error Messages When Using $PHP_SELF as Form Action
Categories : PHP, PHP Configuration
More PHP, XML and XSL for Wireless Content
Categories : PHP, XML, XSL, Wireless