I wanted to be able to hand a simple database query to a function and have it graph it
without me going to a bunch of work, so I whipped up this little function. It takes
a database result and a title. The database result should be from a simple
query like "select group, count(*) from table group by group". Just two columns, with
the first column being the labels, and the second column being numbers.
<?php
include("class-graphs.php3");
Function GraphResult($result,$title) {
/*
Takes a database result set.
The first column should be the name,
and the second column should be the values
*/
/*
db_ should be replaced with your database, aka mysql_ or pg_
*/
$rows=db_NumRows($result);