Exactly what Im trying to do - pull data from a single field in the table and add that to a array.
<?include ("include/jpgraph-1.14/src/jpgraph.php"); // call to main class
include ("include/jpgraph-1.14/src/jpgraph_line.php"); // call to draw a line charts
include ("include/dbcon.inc");
##########################################
$connection = mysql_connect($host,$dbuser,$dbpassword);
if(!$connection)
die("Couldnt connect");
mysql_select_db($database, $connection)
or die("couldnt connect to db".mysql_error());
$res = mysql_query("select quote from ftse")
or die("SELECT error".mysql_error());
while($rs = mysql_fetch_array($res))
{
$array[] = $rs[1];
}
##########################################
$ydata = $array; // works fine when $ydata = array(1.354, 1.288, 1.798, etc )
#code bellow works perfectly provided there is something in that #array
// Create the graph. These two calls are always required
$graph = new Graph(500,270,"auto");
$graph->SetScale("textlin");
// Adjust the margin
$graph->img->SetMargin(57,25,35,45);
// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->mark->SetType(MARK_UTRIANGLE);
//$lineplot->value->show(); //shows value on the graph if uncommented
$lineplot->value->SetColor('darkred');
$lineplot->value->SetFont(FF_FONT1,FS_BOLD);
$lineplot->value->SetFormat('$%0.1f');
// Add the plot to the graph
$graph->Add($lineplot);
$time = date('l jS F Y');
$graph->title->Set("FTSE teckMark Index $time");
$graph->xaxis->title->Set("trading hours");
//$graph->yaxis->title->Set("Share price");
$graph->yaxis->SetColor("red");
$txt=new Text("\$");
$txt->Pos(35,10);
$txt->SetColor("red");
$graph->AddText($txt);
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
//$result1 = mysql_query("select date from amzn");
//$array1 = mysql_fetch_array($result1);
// Specify text labels for the ticks. One label for each data point
// $time - trading hours on stock exchange
$time = array( 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 15, 15.5, 16, 16.5, 17);
//$time = $array1;
$graph->xaxis->SetTickLabels($time);
$graph->xaxis->SetFont(FF_FONT2);
$graph->xaxis->SetTextLabelInterval(2);
$lineplot->SetColor("blue");
$lineplot->SetWeight(1);
// Display the graph
$graph->Stroke();
?>