Pooja11 Posted February 17, 2014 Share Posted February 17, 2014 My php script is generating graph, but when i try to pass values from other php script through session or add "require_once(filename.php)" I get broken image and no error. Iam using JpGraph. My db query php script(db.php) <?php $link = mysql_connect('localhost', 'root', ''); if (!$link) { die('Could not connect: ' . mysql_error()); } mysql_select_db('testcase'); $query = "SELECT COUNT(testRunId) FROM testrundetail GROUP BY platform"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ echo $row['COUNT(testRunId)']; echo "\n"; $array[] = $row['COUNT(testRunId)']; } echo "\n"; echo "pooja"; echo $array[7]; ?> graph generating script - <?php require_once ('../jpgraph-3.5.0b1/src/jpgraph.php'); require_once ('../jpgraph-3.5.0b1/src/jpgraph_bar.php'); $Device = array('3500', '2530ya'); $ydata = array(19); // Width and height of the graph $width = 500; $height = 500; // Create a graph instance $graph = new Graph($width,$height); // Specify what scale we want to use, // text = txt scale for the X-axis // int = integer scale for the Y-axis $graph->SetScale('textint'); // Setup a title for the graph $graph->title->Set('No. of TC passed against particular device'); // Setup titles and X-axis labels $graph->xaxis->title->Set('(Device)'); $graph->xaxis->SetTickLabels($Device); // Setup Y-axis title $graph->yaxis->title->Set('(No. of TC passed)'); // Create the bar plot $barplot=new BarPlot($ydata); // Add the plot to the graph $graph->Add($barplot); // Display the graph $graph->StrokeCSIM(); ?> when i do - require_once('db.php') or when I try to pass the values of $array[] = $row['COUNT(testRunId)']; using session i dnt see the graph. I get broken image. Any help ?? Link to comment https://forums.phpfreaks.com/topic/286254-jpgraph-generating-script-not-working-with-session-and-require_once/ Share on other sites More sharing options...
jazzman1 Posted February 17, 2014 Share Posted February 17, 2014 Do you see the graph when you hard-coding that value rather than using sql? Link to comment https://forums.phpfreaks.com/topic/286254-jpgraph-generating-script-not-working-with-session-and-require_once/#findComment-1469229 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.