Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP][MySQL] PHPLOT + SQL
rembasow1
post
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 4.11.2016

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


Witam, chciałbym stworzyć wykres na podstawie danych z tabeli z bazy MySQL. Problem polega na tym ze wykres jest pusty i nie uzupelnia sie danymi z tabeli. Błędy są zapewne w linijce 21-22 jednak nie wiem jak sobie z nimi poradzić. Bardzo proszę o pomoc i z góry dziękuję (IMG:style_emoticons/default/smile.gif)

  1. <?php
  2. //Include the code
  3. require_once 'phplot.php';
  4.  
  5. mysql_connect("localhost", "root", "pass");
  6. //Define the object
  7. $query = mysql_query("SELECT ID, X1, X2, X3, X4, X5 FROM pomiary");
  8.  
  9.  
  10. $plot = new PHPlot(1000,750);
  11.  
  12. //Set titles
  13. $plot->SetTitle("A 3-Line Plot\nMade with PHPlot");
  14. $plot->SetXTitle('X Data');
  15. $plot->SetYTitle('Y Data');
  16.  
  17. WHILE($row = mysql_fetch_assoc($query))
  18. {
  19. //Define some data$row['']
  20. $example_data = array(
  21. array($row['ID'],$row['x1'],$row['x2'],$row['x3'],$row['x4'],$row['x5']),
  22.  
  23. );
  24. }
  25. $plot->SetDataValues($example_data);
  26.  
  27. //Turn off X axis ticks and labels because they get in the way:
  28. $plot->SetXTickLabelPos('none');
  29. $plot->SetXTickPos('none');
  30.  
  31. //Draw it
  32. $plot->DrawGraph();
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
rad11
post
Post #2





Grupa: Zarejestrowani
Postów: 1 270
Pomógł: 184
Dołączył: 7.10.2012
Skąd: Warszawa

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


Spróbuj:

  1. $example_data[] = array($row['ID'],$row['x1'],$row['x2'],$row['x3'],$row['x4'],$row['x5']);


Ten post edytował rad11 18.11.2016, 12:28:19
Go to the top of the page
+Quote Post
rembasow1
post
Post #3





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 4.11.2016

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


Cytat(emstawicki @ 18.11.2016, 12:17:17 ) *
Na szybko: nadpisujesz pętlą while za każdym razem (ile wierszy zwróci zapytanie) zmienną $example_data


Problem w tym ze wiersze będą dodawane na bierząco (co godzine)




Cytat(rad11 @ 18.11.2016, 12:20:02 ) *
Spróbuj:

  1. $example_data[] = array(
  2. array($row['ID'],$row['x1'],$row['x2'],$row['x3'],$row['x4'],$row['x5']),
  3.  
  4. );



krzaki wyskakują :

Warning: explode() expects parameter 2 to be string, array given in /z4/phplot.php on line 1789

Warning: Invalid argument supplied for foreach() in /z4/phplot.php on line 1789

Warning: explode() expects parameter 2 to be string, array given in /z4/phplot.php on line 1789

Warning: Invalid argument supplied for foreach() in /z4/phplot.php on line 1789

Warning: explode() expects parameter 2 to be string, array given in /z4/phplot.php on line 1789

Warning: Invalid argument supplied for foreach() in /z4/phplot.php on line 1789

Warning: explode() expects parameter 2 to be string, array given in /z4/phplot.php on line 1789

Warning: Invalid argument supplied for foreach() in /z4/phplot.php on line 1789

Warning: explode() expects parameter 2 to be string, array given in /z4/phplot.php on line 1789

Warning: Invalid argument supplied for foreach() in /z4/phplot.php on line 1789

Warning: explode() expects parameter 2 to be string, array given in /z4/phplot.php on line 1789

Warning: Invalid argument supplied for foreach() in /z4/phplot.php on line 1789

Warning: Cannot modify header information - headers already sent by (output started at /z4/phplot.php:1789) in /z4/phplot.php on line 2288

Warning: Cannot modify header information - headers already sent by (output started at /z4/phplot.php:1789) in /z4/phplot.php on line 2289

Warning: Cannot modify header information - headers already sent by (output started at /z4/phplot.php:1789) in /z4/phplot.php on line 2290

Warning: Cannot modify header information - headers already sent by (output started at /z4/phplot.php:1789) in /z4/phplot.php on line 2291

Warning: Cannot modify header information - headers already sent by (output started at /z4/phplot.php:1789) in /z4/phplot.php on line 2311
�PNG  IHDR��@��� PLTE�������g��IDATx���A��6Fa�07]9�|�C:{s�!G�Q+r�7�� ���M� ��gJ�e�`)ffff��y����Ա������]zUm�Y�g�2OK��q{����R��C��9��r[��N��ڎ޹�mЧ���\�8ק�VȨ_��x^��>��ɻ�[����K���3��ב�����������{�}|�iK[�:�1��_�/��{gffff��:����������2�mz돱ۥ���>��en˼���{���0?GD�}�w+��oS�{�mj�m}���7G��u�������ӝ��m�z��V�i?���ů��Q��>�;�6���m�_�u\׷�������0�>�Q/Hz�����N����\W�~�ߖ� �/�u�����>m���֟k���Χ���������G}�׶���_���D/�q���{��/P���tDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtD�n��߰�3�^������x�SG}�^�z�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�IO�=�g.�ʥp�}&����J~��0��9u����"��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$�S�F����Q����k%�j����"��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$�#�q��%jOdzm��k%�j;?� �QӋtHғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtD.V:Z��?��[��|�Zɯ�\�y��鐤'鈤'鈤O��xܞ��;�r�����tD�s�~��#����� �T?���Ho�+|�>���U�HO@�wnD:��L��޹���9�g��{���x0=IG$=IG$=IGt�����sD:�Y0|��/sI:"�I:"��J/G�p��>�I��/���I�#'qS���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#�>:q��ٍ���[��|�2ѯ�~<���:�^�C���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#���#r:��D-xbg_����k%�j{�� >����"��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$��$�S�F����~�3��_+�U���e��z�ҋtHғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtD��;O��z�ɼ�V��6G}t�ҋtHғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtDғtD�n}���^�����t����u>���R�ޏ��2]$�t�����^��w��MK��������^յ�z�傣��c�G���>����m���x33�/����+�DIEND�B`�
Go to the top of the page
+Quote Post

Posty w temacie


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 - 19:40