phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Database: Reading Custom Text File Data Storage

Tag: database, text file   Category: PHP Database
post: 05 Feb 2008 read: 403


Text Data Storage - Part 2: After create a custom text file for data storage alternative at this post, we will read that file.


<?
echo "<pre>File Contents:\n";
readfile('test.dat');

$readdat = fopen('test.dat', 'r');
echo "\n\nSimple Purchase Order:\n";

fscanf($readdat, "%04d-%02d-%02d[^\n]", $n1, $n2, $n3);
echo "Buy Date:\n year = '{$n1}'\n month 
= '{$n2}'\n day = '{n3}'\n";

fscanf($readdat, "%3s*%40[^\n] %f\n", $p3, $p4, $p5);
echo "Code = '{$p3}'\nProperty = '{$p4}'\nPrice = '{$p5}'";
echo "</pre>";

fclose($readdat);
?>


Series this article:
Database: Using Custom Text File as Data Storage Alternative
Database: Reading Custom Text File Data Storage

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
mod_rewrite - Part 1: create your "fantasy" URL

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting