Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL][PHP] import excel
ravikw
post
Post #1





Grupa: Zarejestrowani
Postów: 29
Pomógł: 0
Dołączył: 10.10.2007

Ostrzeżenie: (0%)
-----


Mam poniższy kod który wyświetla mi zawartość plików excela...ale nie mam zielonego pojęcia jak go przerobić aby można było poszczególne komórki zaimportować do bazy mysql. Poproszę o jakąś sugestię



  1. <?
  2.  
  3. require_once 'Excel/reader.php';
  4. $xls = new Spreadsheet_Excel_Reader();
  5. $xls->setOutputEncoding('cp1250');
  6. $xls->read('prowizje/mix.xls');
  7. $xls->sheets[0];
  8. //liczba wierszy
  9. $xls->sheets[0]['numRows'];
  10. //liczba kolumn
  11. $xls->sheets[0]['numCols'];
  12. //komórki
  13. $xls->sheets[0]['cells'];
  14. //komórka o adresie [3;7]
  15. $xls->sheets[0]['cells'][3][7];
  16.  
  17. echo"<table cellSpacing=\"0\" borderColorDark=\"white\" cellPadding=\"1\" align=\"top\" background: \"#CCCCCC\"
  18. borderColorLight=\"#aaaaaa\" border=\"1\" > ";
  19. echo"<tr>";
  20.  
  21. for ($i = 1; $i <= $xls->sheets[0] ['numRows']; $i++)
  22. {
  23. for ($j = 1; $j <= $xls->sheets[0] ['numCols']; $j++) {
  24.  
  25. echo"<td>";
  26.  
  27.  
  28. echo $xls->sheets[0]['cells'][$i][$j] . ' ';
  29. echo"</td>";
  30.  
  31. }
  32. echo"</tr>";
  33. }
  34. echo "</table>";
  35. ?>
  36.  



Myślę że muszę się uporać jakoś z tym fragmentem:

  1. echo $xls->sheets[0]['cells'][$i][$j] . ' ';


tylko jak questionmark.gif?

Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 14:51