Jump to content

JpGraph generating script not working with session and require_once


Pooja11

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.