× Support forum for php-RGraph and php-rgraph content plugin for Joomla

Data from MySql Database using K2

7 Monate 1 Woche her #1234 von jochen
jochen antwortete auf Data from MySql Database using K2
hi,

php-rgraph cannot proccess this kind of sql (one reason is that  rgraph uses as delimiter curly brackets ("{" "}") and cannot proccess sql containing these brackets).
You may use (code) a database interface, which creates as a result JSON-format  data using data parameter "url"

See an example on my site:
www.jschmidt-systemberatung.de/index.php...5&Itemid=659&lang=en

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

7 Monate 1 Woche her #1231 von Vlask
Data from MySql Database using K2 wurde erstellt von Vlask
Hello, thanks for great plugins. I have one issue, that i don't know how solve, since i know next to nothing about php or programming. I'm using onsite K2 modificiation which is using diffent type of mysql data. So i cannot use standard commands to get required data from myslql database. I want to fetch data for graphs from extra fields, which is K2 modification.

Friend of mine made for me mysql command to get required data from phmysqladmin, then i save them as csv and show using old flashchart plugin. Since flash is outdated, i wanted to use php-RGraph and skip step with manual saving to csv and rather use direct reading from database. Sadly i do not know how, because when i try replace code for sql query in your sample code at  www.jschmidt-systemberatung.de/index.php...2&Itemid=659&lang=en

with code needed to get data from K2 extra fields i get only this error 
*** php-rgraph - invalid/missing parameter:
  - no data found via sql="SELECT title, round(substr(extra_fields, ((locate('{"

I guess that issue here is using " for mysql command, because this is also used in many parts of code used for extracting data from k2 extra fields. 

Working code i'm using in phpmyslqadmin to get data for csv looks like this....

SELECT
title,
round(substr(extra_fields,
((locate('{"id":"29","value":"',extra_fields))+(char_length('{"id":"29","value":"'))),
((locate('"}',extra_fields,((locate('{"id":"29","value":"',extra_fields)+(char_length('{"id":"29","value":"'))))))-(locate('{"id":"29","value":"',extra_fields))-(char_length('{"id":"29","value":"')))
))
as final
FROM umhtg_k2_items where substr(extra_fields,
((locate('{"id":"29","value":"',extra_fields))+(char_length('{"id":"29","value":"'))),
((locate('"}',extra_fields,((locate('{"id":"29","value":"',extra_fields)+(char_length('{"id":"29","value":"'))))))-(locate('{"id":"29","value":"',extra_fields))-(char_length('{"id":"29","value":"')))
) >1
order by
cast(substr(extra_fields,
((locate('{"id":"29","value":"',extra_fields))+(char_length('{"id":"29","value":"'))),
((locate('"}',extra_fields,((locate('{"id":"29","value":"',extra_fields)+(char_length('{"id":"29","value":"'))))))-(locate('{"id":"29","value":"',extra_fields))-(char_length('{"id":"29","value":"')))) as decimal)  desc

Is there any way to make this work or should i stay with reading data from csv files?

Wanted to do it few years ago with flashchart and got reply that data are coded JSON, thats why sql code is so long. This is reply from one of K2 moderators...
www.joomlaworks.net/forum/k2-en/41456-k2-vs-flashchart

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Ladezeit der Seite: 0.099 Sekunden
Powered by Kunena Forum

Besucher

Heute: 30
Gestern: 24
Diese Woche: 487
Letzte Woche: 441
Dieser Monat: 1.164
Letzter Monat: 2.369
0171608
United States 30,1% USA
Germany 19,9% Deutschland
Russia 4,4% Russland
France 3,4% Frankreich
Italy 2,8% Italien
Indonesia 2,6% Indonesien
India 2,1% Indien
Poland 2,1% Polen
Spain 2,1% Spanien

Total:

204

Länder

Wir nutzen Cookies auf unserer Website. Einige von ihnen sind essenziell für den Betrieb der Seite, während andere uns helfen, diese Website und die Nutzererfahrung zu verbesssern. Auf keinen Fall werden persönliche oder vertrauliche Daten gespeichert oder weitergegeben.