The graph can be set to connect to
and retieve data directly from a MySQL
database. In order to do this the
graphing software requires some information
about the database. This information
should be placed in a file which can
be read by the graphing software.
The filename should then be specified
in the URL string of the <IMG>
tag with the parameter "dbinfo"
For example, if the file containing
the db information is "dbinfo.txt"
then the <IMG> would be:-
<img
src="area-graph.php?dbinfo=dbinfo.txt"
width=500 height=500> |
The dbinfo file will need to contain
the following information:-
server:
username:
password:
database:
a SELECT
statement for each series of data.
For example, if a MySQL db named
"Sales" has a username of
"salesaccess" and a password
of "dbpass" with 3 tables
"product1", "product2"
and "product3" then the
dbinfo contents would be:-
server:
localhost
username: salesaccess
password: dbpass
database: Sales
SELECT priceUSD FROM product1
SELECT priceUSD FROM product2
SELECT priceUSD FROM product3
|
Please note:
Do NOT add the semi-colon character
to the end of the SELECT statements.
«back to top
|