mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
conditions, limit and offset are functional. conditions needs a rewrite tho.
added examples to trunk. git-svn-id: http://parsecsv-for-php.googlecode.com/svn/trunk@13 339761fc-0c37-0410-822d-8b8cac1f6a97
This commit is contained in:
13
examples/basic.php
Normal file
13
examples/basic.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<pre>
|
||||
<?php
|
||||
|
||||
require_once('../parsecsv.lib.php');
|
||||
|
||||
$csv = new parseCSV();
|
||||
|
||||
$csv->auto('books.csv');
|
||||
|
||||
print_r($csv);
|
||||
|
||||
?>
|
||||
</pre>
|
||||
15
examples/books.csv
Normal file
15
examples/books.csv
Normal file
@@ -0,0 +1,15 @@
|
||||
rating,title,by,type,asin,tags,review
|
||||
0,The Killing Kind,John Connolly,Book,0340771224,,
|
||||
0,The Third Secret,Steve Berry,Book,0340899263,,
|
||||
0,The Last Templar,Raymond Khoury,Book,0752880705,,
|
||||
5,The Traveller,John Twelve Hawks,Book,059305430X,,
|
||||
4,Crisis Four,Andy Mcnab,Book,0345428080,,
|
||||
5,Prey,Michael Crichton,Book,0007154534,,
|
||||
3,The Broker (Paperback),John Grisham,Book,0440241588,book johngrisham,"good book, but is slow in the middle"
|
||||
3,Without Blood (Paperback),Alessandro Baricco,Book,1841955744,,
|
||||
5,State of Fear (Paperback),Michael Crichton,Book,0061015733,,
|
||||
4,The Rule of Four (Paperback),Ian Caldwell,Book,0099451956,book bestseller,
|
||||
4,Deception Point (Paperback),Dan Brown,Book,0671027387,book danbrown bestseller,
|
||||
5,Digital Fortress : A Thriller (Mass Market Paperback),Dan Brown,Book,0312995423,book danbrown bestseller,
|
||||
5,Angels & Demons (Mass Market Paperback),Dan Brown,Book,0671027360,book danbrown bestseller,
|
||||
5,The Da Vinci Code (Hardcover),Dan Brown,Book,0385504209,book movie danbrown bestseller davinci,
|
||||
|
15
examples/conditions.php
Normal file
15
examples/conditions.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<pre>
|
||||
<?php
|
||||
|
||||
require_once('../parsecsv.lib.php');
|
||||
|
||||
$csv = new parseCSV();
|
||||
|
||||
$csv->conditions = array( 'title' => array('*paperback*', '*hardcover*') );
|
||||
|
||||
$csv->auto('books.csv');
|
||||
|
||||
print_r($csv->data);
|
||||
|
||||
?>
|
||||
</pre>
|
||||
21
examples/limit.php
Normal file
21
examples/limit.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<pre>
|
||||
<?php
|
||||
|
||||
require_once('../parsecsv.lib.php');
|
||||
|
||||
$csv = new parseCSV();
|
||||
|
||||
# if sorting is enabled, the whole CSV file
|
||||
# will be processed and sorted and then rows
|
||||
# are extracted based on offset and limit
|
||||
$csv->sort_by = 'title';
|
||||
|
||||
$csv->limit = 3;
|
||||
$csv->offset = 2;
|
||||
|
||||
$csv->auto('books.csv');
|
||||
|
||||
print_r($csv->data);
|
||||
|
||||
?>
|
||||
</pre>
|
||||
Reference in New Issue
Block a user