Hi Karl
I had replaced the query name with my own - see below, commented out. The final code I am using is:
<?PHP
require_once("../jpgraph/jpgraph.php"); //for making graph
require_once("../jpgraph/jpgraph_bar.php"); //this too
require_once('../Connections/brokerid.php'); ?>
<?php
mysql_select_db($database_brokerid, $brokerid);
$query_ChartRS = "SELECT date, user, count(user) as totalcount FROM tbluser GROUP BY user ORDER BY totalcount DESC LIMIT 0, 30
";
#$result = mysql_query($ChartRS) OR die("error: " . mysql_error());
$ChartRS = mysql_query($query_ChartRS, $brokerid) or die(mysql_error());
$row_ChartRS = mysql_fetch_assoc($ChartRS);
$totalRows_ChartRS = mysql_num_rows($ChartRS);
$datay=array();
$labelx=array();
do {
array_push ($datay, $row_ChartRS['totalcount']);
array_push ($labelx, $row_ChartRS ['user']);
} while ($row_ChartRS = mysql_fetch_assoc($ChartRS));
$width = 350;
$height = 500;
$graph = new Graph($width,$height,'auto');
$graph->SetScale("textlin");
$graph->yaxis->scale->SetGrace(10);
$graph->SetMarginColor('#d4d4d4');
$top = 60;
$bottom = 30;
$left = 80;
$right = 30;
$graph->Set90AndMargin($left,$right,$top,$bottom);
$graph->SetShadow();
$graph->title->Set("Top 30 users");
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right','center','right');
// Label align for Y-axis
$graph->yaxis->SetLabelAlign('center','bottom');
#$graph->yaxis->title->Set("Number of times accessed \n");
#$graph->xaxis->title->Set("Broker ID");
#$graph->title->SetFont(FF_FONT1, FS_BOLD, 14);
#$graph->yaxis->title->SetFont(FF_FONT1, FS_NORMAL,12);
#$graph->xaxis->title->SetFont(FF_FONT1, FS_NORMAL, 12);
$bplot = new BarPlot($datay);
$graph->xaxis->SetTickLabels($labelx);
$graph->Add($bplot);
$bplot->SetWidth(1.0);
$bplot->SetFillColor("orange");
#$bplot->SetShadow();
$bplot->value->Show();
$graph->Stroke();
mysql_free_result ($ChartRS);
?>
thanks again for all your help!