jpgraph and mysql passing array

From: Date: Wed, 23 Mar 2011 20:59:50 +0000
Subject: jpgraph and mysql passing array
Groups: php.db 
Request: Send a blank email to php-db+get-47730@lists.php.net to get a copy of this message
Hello, I hope you can help me. The Jpgraph forum seems to be pretty uneventful with participation. I am trying to pass arrays through the image tag to populate my variables for my graph. I keep getting an error that there is no input. Do you have any suggestions? I would greatly appreciate it! I have been trying to figure this out for several hours. Below is my code: I need some help with finding a solution. For some reason my graph is not showing up when it evident that my arrays are being passed. When I use: echo "TEST DATA PRINT"; print_r($datay,false); ------------------- I keep getting the error: Empty input data array specified for plot. ----------------------- My php script is as follows: ----------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>KCRF Dashboard</title> <?php ini_set('display_errors', 1); error_reporting(E_ALL); $term=$_POST['term']; $term2=$_POST['term2']; $term3=$_POST['term3']; //include ('err_reporting.php'); require ('PHP_Scripts/config.php'); require_once ('jpgraph/jpgraph.php'); require_once ('jpgraph/jpgraph_line.php');    $sql = ("SELECT * FROM evdobanding WHERE Market like '%$term' and Cell_Sect = '$term2' and Date = '$term3' ORDER BY distance asc");    $result = mysql_query($sql);    while($row = mysql_fetch_array($result))    {    $datay[] = $row["MBusage"];    $datax[] = $row["Distance"];    }   echo "TEST DATA PRINT";   print_r($datay,false); ?> <style type="text/css"> <!--  #navbar ul {         margin: 0;         padding: 5px;         list-style-type: none;         text-align: center;         background-color: #000;         } #navbar ul li {         display: inline;         } #navbar ul li a {         text-decoration: none;         padding: .2em 1em;         color: #fff;         background-color: #000;         } #navbar ul li a:hover {         color: #000;         background-color: #fff;         } --> </style> </head> <fieldset style="border: 1px ridge limegreen; color: limegreen;"> <legend style="color: #000; font-family: verdana; font-size: 14pt;">EVDO PCMD BANDING</legend> <body> <div id="navbar">   <ul>         <li><a href="index.php">Home</a></li>         <li><a href="dd3.php">EVDO PCMD KPI</a></li>         <li><a href="banding.php">EVDO Distance Banding</a></li>         <li><a href="test.php">TEST_BANDING</a></li>         <li><a href="">LinkHere</a></li>   </ul> </div> </fieldset> <?php echo "You Selected the following:<br>Market = $term <br>Cell_Sector = $term2<br>Timestamp = $term3<br>"; ?> <img src="bandingGraph.php?$datax=$row["Distance"]&$datay=$row["MBusage"];"> // I think this is where I am having issues. </body> </html> --------------------------- My graph script is: <?php // content="text/plain; charset=utf-8" require_once ('jpgraph/jpgraph.php'); require_once ('jpgraph/jpgraph_line.php');    // Create the graph.    $graph = new Graph(1024,450,"auto");    $graph->SetScale("textlin");    $graph->SetShadow();    // Slightly adjust the legend from it's default position    $graph->legend->Pos(0.03,0.5,"right","center");    $graph->legend->SetFont(FF_FONT1,FS_BOLD);    //Setup X-scale      $graph->xaxis->SetTextTickInterval(10);      $graph->xaxis->SetTickLabels($datax);      //$graph->xtick_factor = 1;     $graph->xaxis->SetLabelAngle(30);    // Create the linear plot    $lineplot= new LinePlot($datay);    $p1 = new LinePlot($datay);    $p1->mark->SetType(MARK_DIAMOND);    $p1->mark->SetFillColor("blue");    $p1->mark->SetWidth(;    $p1->SetColor("blue");    $p1->SetCenter();    $p1->SetLegend("EVDO F1 Carrier");    $graph->Add($p1);    // Add the plot to the graph    $graph->Add($lineplot);    // Setup margin and titles    $graph->img->SetMargin(40,40,50,60);    $graph->title->SetMargin(10);    $graph->title->Set("Distance in MIles");    $graph->title->SetFont(FF_VERDANA,FS_BOLD,12);    // set margin color    $graph->SetMarginColor('#dcfade');    // Use built in font    $graph->title->SetFont(FF_ARIAL,FS_NORMAL,14);    $graph->ygrid->SetFill(true,'#EFEFEF@0.6','#e5e5e5@0.6');    $graph->xgrid->Show();    $graph->SetBackgroundImageMix(15);    $graph->legend->Pos(0.02,0.03,"right","top");    $graph->legend->SetFont(FF_FONT1,FS_BOLD);    $graph->xaxis->title->Set("Miles");    $graph->yaxis->title->Set("MBusage");    $graph->SetAlphaBlending();    // Display the graph    $graph->Stroke(); ?> Thank you, Chris

« previous php.db (#47730) next »