<?php
require_once "../../../deppo/tools/script/excel_reader2.php";
$excel = new Spreadsheet_Excel_Reader();
$excel->read($dosya); // reads and stores the excel file data
function sheetData($sheet) {
 $re = '<table>';
	 $re .= "<tr>\n";
	 $re .= "<td>Kod</td>\n";
	 $re .= "<td>Stok Miktari</td>\n";
	 $re .= "<td>Fiyat</td>\n";
	 $re .= "</tr>\n";
$x = 2;
 while($x <= $sheet['numRows']) {
	 $re .= "<tr>\n";
	 $y = 1;
	 while($y <= $sheet['numCols']) {
		 $cell = isset($sheet['cells'][$x][$y]) ? $sheet['cells'][$x][$y] : '';
		 $re .= " <td>$cell</td>\n"; 
		$sql = mysqli_query($conn, "select * from ".$_SESSION['lang']." where ne='kayit' and t5='".$cell."'"); $rs=mysqli_fetch_assoc($sql);
		 $re .= " <td>".$rs["s5"]."</td>\n";
		 $re .= " <td>".$rs["pb1"]."</td>\n"; 
		 $y++;
	 } 
	 $re .= "</tr>\n";
	 $x++;
 }
 return $re .'</table>'; // ends and returns the html table
}
$nr_sheets = count($excel->sheets); // gets the number of worksheets
$excel_data = ''; // to store the the html tables with data of each sheet
for($i=0; $i<$nr_sheets; $i++) {
 $excel_data .= ''. sheetData($excel->sheets[$i]) .'<br/>'; 
}
echo $excel_data; // outputs HTML tables with excel file data
?>