/* ===================================================================== A U R A R I S M Y C S V B L U E P R I N T ===================================================================== Under AURARIS GNU LICENSE (See license.txt for further information) blueprint.php Copyright (C) 2002. Marcelo Gustavo Nuņez, marcelognunez@hotmail.com Check the latest version at http://www.auraris.com.ar/mycsv AURARIS GNU LICENSE -------- This library is free software; you can redistribute it and/or modify it under the terms of the AURARIS GNU LICENSE as published by the Auraris(TM) Limited; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the AURARIS GNU LICENSE for more details. */ require "MyCSV.php"; // Function Library Blueprints (MyCSV.php) // CreateCSV $column = Array(); $column[0] = "User"; $column[1] = "Password"; $column[2] = "Email"; MyCSV_CreateCSV("mailbook.csv", $column); // WriteEntry $data = Array(); $data[0] = "marcelognunez"; $data[1] = "my;pass"; $data[2] = "marcelognunez@\nhotmail.com"; MyCSV_WriteEntry("mailbook.csv", $data); // CSVEntries $entries = MyCSV_CSVEntries("demo.csv"); echo $entries . " entries in demo.csv<br/>\n"; // CSVHeaders $headers = MyCSV_CSVHeaders("demo.csv"); for($a=0;$a<count($headers);$a++) echo $headers[$a] . " is the Column Field $a in demo.csv<br/>\n"; // SelectEntry $entry = MyCSV_SelectEntry("demo.csv", 12); for($a=0;$a<count($headers);$a++) echo $entry[$a] . " is the field $a in 12th entry in demo.csv<br/>\n"; // SearchEntry // Search in Email column (2), the text "nt2", would return 21 to 30 (Position in the file) $matches = MyCSV_SearchEntry("demo.csv", "3", "nt2"); foreach ($matches as $value) { echo "$value, "; } echo "<br/>"; // With SelectEntry you can obtain the data of this entry number // and create a table if you prefer foreach ($matches as $value) { $entry = MyCSV_SelectEntry("demo.csv", $value); foreach ($entry as $field) { echo "$field / "; } echo "<br/>"; } /* Undercontrucction // SQLQuery $query = "SELECT * FROM demo.csv"; MyCSV_SQLQuery("demo.csv", $query); */ // PrintCSV MyCSV_PrintCSV("mailbook.csv"); // PrintLastCSV MyCSV_PrintLastCSV("demo.csv", 3); // MySQL Connection MyCSV_Export_MySQL("demo.csv", "localhost","mysql","", "test","demo"); MyCSV_Import_MySQL("fromsql.csv", "localhost","mysql","", "test","demo"); // XML Connection MyCSV_Export_XML("demo.csv", "demo.xml"); // NOTE: For understand Semicolon and CRLF Functions see generated source code of HTML // Modern Semicolon Storage based in XML philosophy $string = "Hello to all; This text content semicolons; that must damage a CSV datatable;"; $string = MyCSV_Semicolon($string); echo $string; // Print this: Hello to all<sc/> This text content semicolons<sc/> that must damage a CSV datatable $string = MyCSV_Semicolon($string); echo $string; // Print this: Hello to all; This text content semicolons; that must damage a CSV datatable // Modern Unix Line Feed and Carriage Return Storage based in XML philosophy $string = "Hello to all\n This text content unix linefeeds\r\n that must damage a CSV datatable\r"; $string = MyCSV_CRLF($string); echo $string; // Print this: Hello to all<crlf/> This text content unix linefeeds<crlf/> that must damage a CSV datatable $string = MyCSV_CRLF($string); echo $string; // Print this: Hello to all // This text content unix linefeeds // that must damage a CSV datatable // Class Library Blueprints (MyCSV-Class.php) /* $DB = new MyCSV("mailbook2.csv"); $column = Array(); $column[0] = "User"; $column[1] = "Password"; $column[2] = "Email"; $DB->CreateCSV($column); $data = Array(); $data[0] = "marcelognunez"; $data[1] = "mypass"; $data[2] = "marcelognunez@hotmail.com"; $DB->WriteEntry($data); $DB->PrintCSV(); */