Introduction to File Processing with PHP - Part 2 Indexed Files.

Slides:



Advertisements
Similar presentations
Unit 10 Miscellaneous Advanced Topics Introduction to C Programming.
Advertisements

Introduction to C Programming
Introduction to Database Systems1 Records and Files Storage Technology: Topic 3.
Files in C Rohit Khokher. Files in C Real life situations involve large volume of data and in such cases, the console oriented I/O operations pose two.
Elementary Data Types Prof. Alamdeep Singh. Scalar Data Types Scalar data types represent a single object, i.e. only one value can be derived. In general,
1 PHP Storing and Retrieving Data. string fgets(resource handle [, int length]) Reads and returns one line from a file; moves file pointer to next line.
CpSc 3220 File and Database Processing Lecture 1 Course Overview File Storage Basics.
More on Functions PHP mod 4 B. Simple Mail Transfer Protocol (SMTP) mail($to, $subject, $msg, $mailheaders); m08/8-1simple_form.html m08/8-1send_simpleform.php.
COMP An Introduction to Computer Programming : University of the West Indies COMP6015 An Introduction to Computer Programming Lecture 06.
Programming In C++ Spring Semester 2013 Lecture 10 Programming In C++, Lecture 10 By Umer Rana.
File processing with functions H&K Chapter 3 Instructor – Gokcen Cilingir Cpt S 121 (June 27, 2011) Washington State University.
Bitmap Index Buddhika Madduma 22/03/2010 Web and Document Databases - ACS-7102.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Introduction Data files –Can be created, updated,
Chapter 11 C File Processing Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Recap of Feb 27: Disk-Block Access and Buffer Management Major concepts in Disk-Block Access covered: –Disk-arm Scheduling –Non-volatile write buffers.
Elementary Data Types Scalar Data Types Numerical Data Types Other
Accessing Files in CCS-2303, C-Term Accessing Files in C CS-2303 System Programming Concepts (Slides include materials from The C Programming Language,
IS 1181 IS 118 Introduction to Development Tools Week 2.
1 CS428 Web Engineering Lecture 23 MySQL Basics (PHP - VI)
Website Development with PHP and MySQL Saving Data.
 2007 Pearson Education, Inc. All rights reserved C File Processing.
File Handling In C By - AJAY SHARMA. We will learn about- FFile/Stream TText vs Binary Files FFILE Structure DDisk I/O function OOperations.
 2007 Pearson Education, Inc. All rights reserved C File Processing.
UNIX Files File organization and a few primitives.
Chapter 8 : Binary Data Files1 Binary Data Files CHAPTER 8.
1 Chapter 7 – Object-Oriented Programming and File Handling spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information.
Storing and Retrieving Data
Outline Overview Opening a file How to create a file ? Closing a File Check End-of-file Reading a File Line by Line Reading a File Character by Character.
PHP 4 Files, Functions. Opening a File The fopen() function is used to open files in PHP. The first parameter of this function contains the name of the.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting Files & Directories.
LECTURE 4 Files, File open, Read, Write. File Upload - In this lecture we will teach you how to open, read, and close a file on the server. - PHP Open.
Chapter 11 File Processing. Objectives In this chapter, you will learn: –To be able to create, read, write and update files. –To become familiar with.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved Introduction Introduce some standard library functions.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 11 – File Processing Outline 11.1Introduction.
Chapter 7 : File Processing1 File-Oriented Input & Output CHAPTER 7.
1 CHAPTER6 CHAPTER 6. Objectives: You’ll learn about;  Introduction  Files and streams  Creating a sequential access file  Reading data from a sequential.
FILE IO in ‘C’ by Dr P.Padmanabham Professor (CSE)&Director Bharat Institute of Engineering &Technology Hyderabad Mobile
CHAPTER 8 PHP Advanced อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
chap8 Chapter 12 Files (reference: Deitel ’ s chap 11)
C File Processing. Objectives To be able to create, write and update files. To become familiar with sequential access file processing. To become familiar.
SQlite. SQLite is a opensource SQL database that stores data to a text file on a device. Android comes in with built in SQLite database implementation.
GAME203 – C Files stdio.h C standard Input/Output “getchar()”
Chapter 12 Files (reference: Deitel ’ s chap 11) chap8.
Web Page Designing With Dreamweaver MX\Session 1\1 of 9 Session 3 PHP Advanced.
 2007 Pearson Education, Inc. All rights reserved. 1 C File Processing.
Files. FILE * u In C, we use a FILE * data type to access files. u FILE * is defined in /usr/include/stdio.h u An example: #include int main() { FILE.
Connecting to Files In order to read or write to a file, we need to make a connection to it. There are several functions for doing this. fopen() – makes.
Introduction to File Processing with PHP. Review of Course Outcomes 1. Implement file reading and writing programs using PHP. 2. Identify file access.
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
 2007 Pearson Education, Inc. All rights reserved C File Processing.
Silberschatz and Galvin  C Programming Language Kingdom of Saudi Arabia Ministry of Higher Education Al-Majma’ah University College of Education.
11 C File Processing.
Module 11: File Structure
CGS 3066: Web Programming and Design Spring 2016
TMF1414 Introduction to Programming
CS111 Computer Programming
File I/O We are used to reading from and writing to the terminal:
Chapter 11 – File Processing
<?php require("header.htm"); ?>
CSE 333 – Section 3 POSIX I/O Functions.
Text and Binary File Processing
Review & Lab assignments
Hmjngj jxhngh.
Fundamental of Programming (C)
RDBMS Chapter 4.
File Organization.
Chapter 12: File I/O.
CSc 352 File I/O Saumya Debray Dept. of Computer Science
Professor Jodi Neely-Ritz University of Florida
File I/O We are used to reading from and writing to the terminal:
Presentation transcript:

Introduction to File Processing with PHP - Part 2 Indexed Files

Review of Course Outcomes 1. Implement file reading and writing programs using PHP. 2. Identify file access schemes, including: sequential file access direct file access indexed sequential file access. 3. Describe file-sorting and file-searching techniques. 4. Describe data compression and encryption techniques. 5. Design a rational database using E-R modeling techniques. 6. Build a relational database. 7. Write database queries using SQL. 8. Implement a web-based relational database using MySQL.

Organization of Records in Files Heap – a record can be placed anywhere in the file where there is space Sequential – store records in sequential order, perhaps based on the value of the search key of each record Indexing – Keep two files, the Data File and an Index File and the data file. Index records hold file pointers of Data records Hashing – a hash function computed on some attribute of each record; the result specifies in which block of the file the record should be placed

Implementing CRUD paradigm in PHP Use PHP file functions There a many of them We will start with a simple subset that are similar to file functions used in C and in other C-based languages

The PHP filesystem functions php php

A C-like subset fopen – fgets – fwrite – fclose –

To Open a File for Processing resource fopen ( string $filename, string $mode [, bool $use_include_path = false [, resource $context ]] )

Mode Codes modeDescription 'r'Open for reading only; place the file pointer at the beginning of the file. 'r+'Open for reading and writing; place the file pointer at the beginning of the file. 'w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. 'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. 'a' Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. 'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it. 'x' Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2)system call. 'x+'Create and open for reading and writing; otherwise it has the same behavior as 'x'.

Read a string from a file string fgets ( resource $handle [, int $length ] )

Write a string to a file int fwrite ( resource $handle, string $string [, int $length ] )

Close a file to processing bool fclose ( resource $handle )

Test if a file is at the end bool feof ( resource $handle )

Move the file pointer int fseek ( resource $handle, int $offset [, int $w hence = SEEK_SET ] )

Read a string string fread ( resource $handle, int $length )

Read an entire file array file ( string $filename [, int $flags = 0 [, resource $context ]] )

Read an entire file string file_get_contents ( string $filename [, boo l $use_include_path = false [, resource $context [, int $offset = - 1 [, int $maxlen ]]]] )

Write to a file int file_put_contents ( string $filename, mixed $data [, int $flags = 0 [, resource $context ]] )mixed