MySQL -> JpGraph Interface

Hi
I have created a interface script to view JpGraph

Hi Krister

What a great script. Now I have something to play with today and maybe translate to Danish.

Best regards,

Henrik

thanks man!!!
Your site is inspirational :headbang:

Hi Henrik and Mario
I’m glad you like it :smiley:
If you downloaded the first version you should delete the database connection info in common_en.php
I forgot to erase it :oops:
The database connection info should be entered in get_data.php, and it might mess things up if it remains in common_en.php

:slight_smile: Krister

Hi Krister

I have been playing with your scripts - but cant get it to work.

I dont know whats wrong. I have downloaded your latest release.

Link: http://www.buskelundtoften.dk/vejret/webpages/multiwx_en.php

What can be the problem?

Best regards,

Henrik

Hi Henrik
Is the path to Jpgraph correct?
The default path is Jpgraph src folder is in the same folder as multiwx and webpages folder
You can change this in multigraph.php

:slight_smile: Krister

Hi Krister

Thanks for your reply.

Yes my “src” folder is in the same folder as multiwx and webpages folder.

I have dobble checked the connection string to mysql database and everything seems correct.

Best regards,

Henrik

Hi again
change

 include ($com_lang);

in get_data.php to

include ('common_en.php');

and see if it works

:slight_smile: Krister

Hi Krister

Sorry - still no luck.

Best regards,

Henrik

Ps. my webhotel is running on a Windows 2003 server - could that be the problem?

Hi again
If you go directly to http://www.buskelundtoften.dk/vejret/multiwx/multigraph.php
you will see this: getmysql error (If it works you will see a graph).
Before it complained that it could not find the included file, so that is fixed, i don’t know why it did not work.
If you are using the original WDMYSQL table you need to change the mysql_query because it uses datetime and that field does not exist
in the original table. == getmysql error
You also have to change the arrays $db_field , $db_units and $db_fieldname so it matches your database

:slight_smile: Krister

Hi again

Yes i use the origina wdmysql database/table

Im not sure what to change in the script.

Best regards,

Henrik

Hi again
In common_en.php the array $db_field should contain the field names of the database like this:

$db_field = array("" => "", 1 => "station_id", 2 => "date", 3 => "time", 4 => "average_windspeed"


and in

$db_units = array("" => "", 1 => "", 2 => "Date", 3 => "Time", 4 => "m/s"


and in $db_fieldname the fields you want in the select droplist. The key number is the same as in $db_field , the text is just for the droplist so it can be translated.

The query:

$sql = mysql_query("SELECT UNIX_TIMESTAMP(DATETIME) AS DATETIME, DATETIME, $que1 AND humidity IS NOT NULL ORDER BY DATETIME ASC") or die("getmysql error");

does not work because your database does not have DATETIME, you have to use DATE and TIME in the query , i’m not sure how to do that #-o

:slight_smile: Krister

Hi Krister

Thank you very much for your reply.

I hope somebody can modify your excellent script to work with the original wdmysql database.

Best regards,

Henrik

Hi again
I have modified the script so it should work with the WDMySQL-table
(It works on my testtable on localhost with 2 hours of data) :roll:
I have not added all fields for the select droplist, but it is easy to add more in common_en.php and rename/translate them.
I have attached a zip-file with the new code
:slight_smile: Krister

Hi Krister

Thanks for all your work.

Unfortunately I cant get it to work. I have the mysql settings in the get_data.php file.

Anything else to do?

www.buskelundtoften.dk/vejret/webpages/multiwx_en.php

Best regards,

Henrik

Hi
I have changed fonts in multigraph.php, try this new upload.
I have also included a testfile.php, try that one and see if it outputs any values if the new multigraph.php does not work

:slight_smile: Krister

Hi Krister

Still no luck.

There is a lot of things in this link - but im not sure what is means:

http://www.buskelundtoften.dk/vejret/multiwx/testfile.php

Best regards,

Henrik

line 95 in multigraph.php
change

$graph->title->Pos(0.08, 0.02, "left", "top");

in

$graph->title->SetPos(0.08, 0.02, "left", "top");

for some strange reason some jpgraph-instalations don’t uderstand the “Pos”
change it to “SetPos”

Jozef

hope this helps

Hi

That did the trick.

But when I try to make different graphs - only the temperature graph from today shows up.

http://www.buskelundtoften.dk/vejret/webpages/multiwx_en.php

Thanks for all your help.

Best regards,

Henrik

Hi again
I have changed Pos to SetPos in the script (Thanks Jozef) :slight_smile:
I have also changed the initial query so it will load faster.
I have added a couple of files for testing if sessions and db-query works.
Make a time and data selection and click on create graph in: multiwx_en_test.php
Check the result in the S_SESSION array, and click on the link: open testfile.php below script timer.
If sessions works the new page will be filled with values from the selections.
You can test it here http://hasslosa.se/weather/webpages/multiwx_en_test.php (there is values between 2007-11-19 and 2007-11-20)

:slight_smile: Krister