PHP - select limited csv rows -


i new php , trying display contents csv in webpage. able display values successfully. need find minimum , maximum of columns can include slider using user can select range. code have find minimum , maximum values columns.

$total_columns = 0; $handle1 = fopen('demo.csv', 'r'); while (false !== ($row = fgetcsv($handle1, 1000, ','))) {     0 === $total_columns , $total_columns = count($row);     $i = 1;     while (++$i <= $total_columns) {          $data1[$i][] = (int) $row[$i - 1];      } }  $i = 0; while (++$i <= $total_columns) {     $_session["min-column-$i"] = min($data1[$i]);     $_session["max-column-$i"] = max($data1[$i]); } 

using above code, have implemented slider functionality range selection.. after range selection, need display rows satisfy range. example,

  • a1 1 2 3
  • a2 3 4 5
  • a3 8 9 10

if have slider column 1(min 1 , max 8) , if choose range value 8, need display a3 row. output should be,

  • a3 8 9 10

is possible php?

keep in mind php server side code you'll have few options here.

  1. process data , create div each row hiding of them. store ranges in javascript , write method check user value against ranges , hide/show respective row.
  2. on select of range value, make ajax call php script determine row , return it. you'd display in single results div.
  3. take similar approach #2, post data script did same thing , displayed results.

i'd #1 since have process of csv data determine ranges anyway. #2 , #3 both require reprocess data 2nd time results.


Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

java.util.scanner - How to read and add only numbers to array from a text file -

iphone - Three second countdown in cocos2d -