phpeveryday.com

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


Database: Using CSV as Data Storage Alternative

Tag: csv, database   Category: PHP Database
post: 05 Feb 2008 read: 476


CSV Database Step By Step Tutorial - Part 1: Comma-Separated Value (CSV)is a popular format for transferring data between two different systems. That is why, we can use CSV as alternative data storage. We can use CSV as format when users want to download data from our web.

Fortunately, PHP provides a pair of functions that make handling CSV files easy: fgetcsv() and fputcsv(). But, it just works at PHP 5. It is really simple. Look following code:


<?
$line1 = array('1','Keyboard');
$line2 = array('2','Monitor');

$csv = fopen('test.csv', 'w');

fputcsv($csv, $line1);
fputcsv($csv, $line2);

fclose($csv);

?>


Series this article:
Database: Using CSV as Data Storage Alternative
Database: Read CSV Format

| 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