Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Pobieranie 20k rekordów
slawek19926
post
Post #1





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 29.07.2016

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


Witam.

Mam poważny problem. W bazie danych znajduje sie 12k+ rekordów i mam problem z wyświetleniem wszystkich rekordów (wyświetlają się, ale trwa to bardzo długo)

KOD strony.

Proszę o pomoc.

P.S.
Nie chcę rezygnować z dataTables.js
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
slawek19926
post
Post #2





Grupa: Zarejestrowani
Postów: 33
Pomógł: 0
Dołączył: 29.07.2016

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


Czyli muszę skorzystać z tego?
  1. <?php
  2.  
  3. /*
  4.  * DataTables example server-side processing script.
  5.  *
  6.  * Please note that this script is intentionally extremely simply to show how
  7.  * server-side processing can be implemented, and probably shouldn't be used as
  8.  * the basis for a large complex system. It is suitable for simple use cases as
  9.  * for learning.
  10.  *
  11.  * See <a href="http://datatables.net/usage/server-side" target="_blank">http://datatables.net/usage/server-side</a> for full details on the server-
  12.  * side processing requirements of DataTables.
  13.  *
  14.  * @license MIT - <a href="http://datatables.net/license_mit" target="_blank">http://datatables.net/license_mit</a>
  15.  */
  16.  
  17. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  18.  * Easy set variables
  19.  */
  20.  
  21. // DB table to use
  22. $table = 'datatables_demo';
  23.  
  24. // Table's primary key
  25. $primaryKey = 'id';
  26.  
  27. // Array of database columns which should be read and sent back to DataTables.
  28. // The `db` parameter represents the column name in the database, while the `dt`
  29. // parameter represents the DataTables column identifier. In this case object
  30. // parameter names
  31. $columns = array(
  32. array( 'db' => 'first_name', 'dt' => 'first_name' ),
  33. array( 'db' => 'last_name', 'dt' => 'last_name' ),
  34. array( 'db' => 'position', 'dt' => 'position' ),
  35. array( 'db' => 'office', 'dt' => 'office' ),
  36. 'db' => 'start_date',
  37. 'dt' => 'start_date',
  38. 'formatter' => function( $d, $row ) {
  39. return date( 'jS M y', strtotime($d));
  40. }
  41. ),
  42. 'db' => 'salary',
  43. 'dt' => 'salary',
  44. 'formatter' => function( $d, $row ) {
  45. return '$'.number_format($d);
  46. }
  47. )
  48. );
  49.  
  50. // SQL server connection information
  51. $sql_details = array(
  52. 'user' => '',
  53. 'pass' => '',
  54. 'db' => '',
  55. 'host' => ''
  56. );
  57.  
  58.  
  59. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  60.  * If you just want to use the basic configuration for DataTables with PHP
  61.  * server-side, there is no need to edit below this line.
  62.  */
  63.  
  64. require( 'ssp.class.php' );
  65.  
  66. echo json_encode(
  67. SSP::simple( $_POST, $sql_details, $table, $primaryKey, $columns )
  68. );
Go to the top of the page
+Quote Post

Posty w temacie
- slawek19926   Pobieranie 20k rekordów   22.09.2016, 09:09:12
- - kapslokk   Się nie dziwie, że trwa to długo, przeglądarka ma ...   22.09.2016, 09:13:14
- - slawek19926   Kod teraz wygląda tak i nadal jest problem :/   22.09.2016, 09:24:59
- - nospor   Nadal na raz pobierasz wszystkie dane z bazy... Zr...   22.09.2016, 09:29:54
- - slawek19926   To właśnie wiem, tylko nie wiem jak to ustawić. Ja...   22.09.2016, 09:33:50
- - nospor   No i wlasnie dlatego ajaxem miales zapodowac kolej...   22.09.2016, 09:38:56
- - slawek19926   Kombinuje ale za chińca niemam pojęcia jak   22.09.2016, 09:41:31
- - nospor   Ten przyklad wydaje sie lepszy https://datatables....   22.09.2016, 09:47:13
- - slawek19926   Dobrze rozumiem, że muszę zrezygnować z np: [PHP] ...   22.09.2016, 09:56:10
- - nospor   Tak, masz zwracac teraz dane dla ajaxa czyli JSON....   22.09.2016, 10:04:04
- - slawek19926   Czyli muszę skorzystać z tego? [PHP] pobierz, plai...   22.09.2016, 10:08:53
- - nospor   jak sie upierasz to mozesz korzystac z ich klasy S...   22.09.2016, 10:12:30
- - slawek19926   Działa Teraz pytanie jak za pomocą tego mam wyko...   22.09.2016, 10:22:36
- - nospor   A konkretnie o co ci chodzi?   22.09.2016, 10:24:54
- - slawek19926   Dokładniej o wyliczanie kwot brutto i po rabacie. ...   22.09.2016, 10:30:08
- - nospor   Cytatwyszukiwanie też nie, oraz pokazuje się komun...   22.09.2016, 10:43:25
- - slawek19926   Problem w tym, że nic nie pokazuje :/   22.09.2016, 12:51:44
- - nospor   TO nic dziwnego ze masz invalid json response skor...   22.09.2016, 12:54:02
- - slawek19926   Tylko, że do 14 strony wszystko działa bez problem...   22.09.2016, 13:09:34
- - viking   Sprawdź co wysyłasz i odbierasz. Może po 14 strona...   22.09.2016, 13:16:24
- - icemanwlkp   Czy nie lepiej te wyliczenia robić procedurą lub z...   22.09.2016, 13:19:30
- - slawek19926   Pewnie i lepiej, ale i tak nie mam zielonego pojęc...   22.09.2016, 13:42:21
- - nospor   wracajac do 14 strony. Patrzyles jaki request idzi...   22.09.2016, 14:02:15
|- - kapslokk   Cytat(nospor @ 22.09.2016, 15:02:15 )...   22.09.2016, 14:50:56
- - slawek19926   Tzn co mi wywala w zakładce post?   22.09.2016, 14:29:54
- - nospor   tak   22.09.2016, 14:36:22
- - slawek19926   Może prościej jak podam link   22.09.2016, 14:38:42
- - viking   A poza tym nie ustawiłeś nagłówków odpowiedzi dla ...   22.09.2016, 15:05:57


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

 



RSS Aktualny czas: 9.10.2025 - 13:50