<?php
include("./file_db.class.php"); //Create new recordset $rec = new file_db; //Define the file to read $rec->filename = "./example.csv"; //Open File and load first recordset $rec->open_db(); //Now first recordset can be displayed echo $rec->record["name"]."-".$rec->record["city"]."<br>"; //If you want to display all use something like this while (!$rec->EOF) { echo $rec->record["name"]."-".$rec->record["city"]."<br>"; $rec->move_next(); } //You can also start with the last recordset $rec->move_last(); while (!$rec->BOF) { echo $rec->record["name"]."-".$rec->record["city"]."<br>"; $rec->move_prev(); } //Now lets manipulate... //First select the recordset $rec->move_first(); $rec->move_next(); //Echo some contents echo $rec->record["name"]; //Change some content $rec->record["name"] = "Kai-Uwe"; //Update the selection $rec->update(); //Now add a new recordset $rec->add_new(); //Now add the content $rec->record["name"]="Pierre"; $rec->record["city"]="Lyon"; $rec->record["country"]="France"; //At last you have to update the db $rec->update(); $rec->move_first(); $rec->delete(); $rec->close_db(); ?>
|