#native_company# #native_desc#

HTML_Graphs Page 2

By Tim Perdue
on July 30, 2000

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.



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_



    if ((!$result) || ($rows 1)) {

"None Found.n";

    } else {



        for ($j=0$j db_NumRows($result); $j++) {

            if (
db_result($result$j0) != "" && db_result($result$j1) != "" ) {

$names[$j]= db_result($result$j0);

$values[$j]= db_result($result$j1);




        This is another function detailed below