1

I am using php lib graph to show some data from database. When I am using it inside a div element of my page the graph image is displayed. But I am unable to show the other page elements like forms.

date_default_timezone_set("Asia/Calcutta");
include("includes.php");
include('phpgraphlib.php');
session_start();
$graph = new PHPGraphLib(350,280);
$data=  array();
$Select_Query = "select level,sum(score) score,sum(total_time) total_time from 
user_score where user_id='2' group by level";
 $result_query = mysql_query($Select_Query);
 $rows = mysql_num_rows($result_query);

 while($row=mysql_fetch_array($result_query)){
  $data[$row['level']] = $row['score'];
   }
$graph->setBackgroundColor("black");
$graph->addData($data);
$graph->setBarColor('255,255,204');
$graph->setTitle('IQ Scores');
$graph->setTitleColor('yellow');
$graph->setupYAxis(12, 'yellow');
$graph->setupXAxis(20, 'yellow');
$graph->setGrid(false);
$graph->setGradient('silver', 'gray');
$graph->s`enter code here`etBarOutlineColor('white');
$graph->setTextColor('white');
$graph->setDataPoints(true);
$graph->setDataPointColor('yellow');
$graph->setLine(true);
$graph->setLineColor('yellow');
$graph->createGraph();

And I have some html div and form after that. But only graph image is showing on the browser but not the form. How to fix it?

codl
  • 387
  • 1
  • 13
user1755949
  • 93
  • 1
  • 12

1 Answers1

2

You need to generate the graph image from a separate PHP script, and insert it in your page with an img tag.

Move your graph creation code to another file like, say, graph.php, and insert it with <img src="graph.php"/> in your page.

codl
  • 387
  • 1
  • 13