jpgraph and mysql passing array

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=3D"http://www.w3.org/1999/xhtml">



<head>

<title>KCRF Dashboard</title>

<?php

ini_set('display_errors', 1);

error_reporting(E_ALL);



$term=3D$_POST['term'];

$term2=3D$_POST['term2'];

$term3=3D$_POST['term3'];



//include ('err_reporting.php');

require ('PHP_Scripts/config.php');

require_once ('jpgraph/jpgraph.php');

require_once ('jpgraph/jpgraph_line.php');



=A0=A0 $sql =3D ("SELECT * FROM evdobanding WHERE Market like '%$term' and
Cell_Sect =3D '$term2' and Date =3D '$term3' ORDER BY distance asc");

=A0=A0 $result =3D mysql_query($sql);



=A0=A0 while($row =3D mysql_fetch_array($result))

=A0=A0 {

=A0=A0 $datay[] =3D $row["MBusage"];

=A0=A0 $datax[] =3D $row["Distance"];

=A0=A0 }

=A0 echo "TEST DATA PRINT";

=A0 print_r($datay,false);

?>





<style type=3D"text/css">

<!--



=A0#navbar ul {

=A0=A0=A0=A0=A0=A0=A0 margin: 0;

=A0=A0=A0=A0=A0=A0=A0 padding: 5px;

=A0=A0=A0=A0=A0=A0=A0 list-style-type: none;

=A0=A0=A0=A0=A0=A0=A0 text-align: center;

=A0=A0=A0=A0 =A0=A0=A0background-color: #000;

=A0=A0=A0=A0=A0=A0=A0 }



#navbar ul li {

=A0=A0=A0=A0=A0=A0=A0 display: inline;

=A0=A0=A0=A0=A0=A0=A0 }



#navbar ul li a {

=A0=A0=A0=A0=A0=A0=A0 text-decoration: none;

=A0=A0=A0=A0=A0=A0=A0 padding: .2em 1em;

=A0=A0=A0=A0=A0=A0=A0 color: #fff;

=A0=A0=A0=A0=A0=A0=A0 background-color: #000;

=A0=A0=A0=A0=A0=A0=A0 }



#navbar ul li a:hover {

=A0=A0=A0=A0=A0=A0=A0 color: #000;

=A0=A0=A0=A0=A0=A0=A0 background-color: #fff;

=A0=A0=A0=A0=A0=A0=A0 }



-->

</style>



</head>



<fieldset style=3D"border: 1px ridge limegreen; color: limegreen;">
<legend style=3D"color: #000; font-family: verdana; font-size:
14pt;">EVDO PCMD BANDING</legend> <body> <div id=3D"navbar">

=A0 <ul>

=A0=A0=A0=A0=A0=A0=A0 <li><a href=3D"index.php">Home</a></li>

=A0=A0=A0=A0=A0=A0=A0 <li><a href=3D"dd3.php">EVDO PCMD KPI</a></li>

=A0=A0=A0=A0=A0=A0=A0 <li><a href=3D"banding.php">EVDO Distance Banding</a>=
</li>

=A0=A0=A0=A0=A0=A0=A0 <li><a href=3D"test.php">TEST_BANDING</a></li>

=A0=A0=A0=A0=A0=A0=A0 <li><a href=3D"">LinkHere</a></li>

=A0 </ul>

</div>



</fieldset>

<?php

echo "You Selected the following:<br>Market =3D $term <br>Cell_Sector =3D
$term2<br>Timestamp =3D $term3<br>"; ?>



<img src=3D"bandingGraph.php?$datax=3D$row["Distance"]&$datay=3D$row["MBusa=
ge"];">
// I think this is where I am having issues.





</body>

</html>

---------------------------



My graph script is:



<?php // content=3D"text/plain; charset=3Dutf-8"

require_once ('jpgraph/jpgraph.php');

require_once ('jpgraph/jpgraph_line.php');



=A0=A0 // Create the graph.

=A0=A0 $graph =3D new Graph(1024,450,"auto");



=A0=A0 $graph->SetScale("textlin");

=A0=A0 $graph->SetShadow();



=A0=A0 // Slightly adjust the legend from it's default position

=A0 =A0$graph->legend->Pos(0.03,0.5,"right","center");

=A0=A0 $graph->legend->SetFont(FF_FONT1,FS_BOLD);



=A0=A0 //Setup X-scale

=A0=A0=A0=A0 $graph->xaxis->SetTextTickInterval(10);

=A0=A0=A0=A0 $graph->xaxis->SetTickLabels($datax);

=A0=A0=A0=A0 //$graph->xtick_factor =3D 1;

=A0=A0=A0 $graph->xaxis->SetLabelAngle(30);



=A0=A0 // Create the linear plot

=A0=A0 $lineplot=3D new LinePlot($datay);

=A0=A0 $p1 =3D new LinePlot($datay);

=A0=A0 $p1->mark->SetType(MARK_DIAMOND);

=A0=A0 $p1->mark->SetFillColor("blue");

=A0=A0 $p1->mark->SetWidth(;

=A0=A0 $p1->SetColor("blue");

=A0=A0 $p1->SetCenter();

=A0=A0 $p1->SetLegend("EVDO F1 Carrier");

=A0=A0 $graph->Add($p1);



=A0=A0 // Add the plot to the graph

=A0=A0 $graph->Add($lineplot);



=A0=A0 // Setup margin and titles

=A0=A0 $graph->img->SetMargin(40,40,50,60);

=A0=A0 $graph->title->SetMargin(10);

=A0=A0 $graph->title->Set("Distance in MIles");

=A0=A0 $graph->title->SetFont(FF_VERDANA,FS_BOLD,12);



=A0=A0 // set margin color

=A0=A0 $graph->SetMarginColor('#dcfade');

=A0=A0 // Use built in font

=A0=A0 $graph->title->SetFont(FF_ARIAL,FS_NORMAL,14);

=A0=A0 $graph->ygrid->SetFill(true,'#EFEFEF [at] 0.6','#e5e5e5 [at] 0.6');



=A0=A0 $graph->xgrid->Show();

=A0=A0 $graph->SetBackgroundImageMix(15);

=A0=A0 $graph->legend->Pos(0.02,0.03,"right","top");

=A0=A0 $graph->legend->SetFont(FF_FONT1,FS_BOLD);







=A0=A0 $graph->xaxis->title->Set("Miles");

=A0=A0 $graph->yaxis->title->Set("MBusage");

=A0=A0 $graph->SetAlphaBlending();



=A0=A0 // Display the graph

=A0=A0 $graph->Stroke();

?>





Thank you,



Chris

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Chris Stinemetz [ Mi, 23 März 2011 21:59 ] [ ID #2057028 ]

Re: jpgraph and mysql passing array

Chris Stinemetz wrote:

> 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);
>
> ?>
<snip>
> Thank you,
>
>
>
> Chris

If $datay shows as empty, my first step would be to check that your SQL
query doesn't return an empty set.


Cheers
--
David Robley

"This ocean is calm," said the sailors specifically.
Today is Pungenday, the 10th day of Discord in the YOLD 3177.


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
David Robley [ Do, 24 März 2011 01:05 ] [ ID #2057086 ]

Re: jpgraph and mysql passing array

On Wed, 23 Mar 2011 15:59:50 -0500
Chris Stinemetz <chrisstinemetz [at] gmail.com> wrote:

> Hello,

> <?php
>
> echo "You Selected the following:<br>Market = $term <br>Cell_Sector =
> $term2<br>Timestamp = $term3<br>"; ?>

note the closing PHP tag above, and now

this line here, is not in php, and does not echo the php variables.
>
> <img src="bandingGraph.php?$datax=$row["Distance"]&$datay=$row["MBusage"];">
> // I think this is where I am having issues.
>


try instead
<?php
echo '<img src="bandingGraph.php?datax='.$row["Distance"].'&datay='.$row["MBusage"].'">';
?>
--
Simcha Younger <simcha [at] syounger.com>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Simcha [ Do, 24 März 2011 10:41 ] [ ID #2057087 ]

Re: jpgraph and mysql passing array

Would you try an experiment?

In this line:
$sql =3D ("SELECT * FROM evdobanding WHERE Market like '%$term' and=
Cell_Sect =3D '$term2' and Date =3D '$term3' ORDER BY distance asc");

Change to:
$sql =3D "SELECT * FROM evdobanding WHERE Market like '%".$term."' and=
Cell_Sect =3D '".$term2."' and Date =3D '".$term3."' ORDER BY distance=
asc";

That is, remove the parenthesis and concatenate the variables into the=
string.



--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Brian Smither [ So, 27 März 2011 04:44 ] [ ID #2057171 ]

Re: Re: jpgraph and mysql passing array

On Sat, Mar 26, 2011 at 9:44 PM, Brian Smither <bhsmither [at] gmail.com> wrote:
> Would you try an experiment?

Thanks for for the suggestion but this didn't seem to work. I beleive
it is a header conflict based on what I have researched.
I just can't seem to find a solution.

>
> In this line:
> $sql = ("SELECT * FROM evdobanding WHERE Market like '%$term' and Cell_Sect = '$term2' and Date = '$term3' ORDER BY distance asc");
>
> Change to:
> $sql = "SELECT * FROM evdobanding WHERE Market like '%".$term."' and Cell_Sect = '".$term2."' and Date = '".$term3."' ORDER BY distance asc";
>
> That is, remove the parenthesis and concatenate the variables into the string.
>

The code in the PHP block:

echo "TEST DATA PRINT";
print_r($datay,false);

is passing all the values from the sql query because I can see them on
the page with the jpgraph error.

For example:

TEST DATA PRINTArray ( [0] => 665 [1] => 7093 [2] => 30000 [3] =>
45816 [4] => 70848 [5] => 41365 [6] => 35676 [7] => 22434 [8] => 5450
[9] => 29131 [10] => 35244 [11] => 48614 [12] => 51748 [13] => 55497
[14] => 79042 [15] => 732 [16] => 1375 [17] => 1094 [18] => 897 [19]
=> 1122 [20] => 3059 [21] => 5350 [22] => 5080 [23] => 3082 [24] =>
2737 [25] => 326 [26] => 1334 [27] => 736 [28] => 469 [29] => 127 [30]
=> 105 [31] => 111 [32] => 197 [33] => 208 [34] => 950 [35] => 9 [36]
=> 9 [37] => 19 [38] => 8 [39] => 17 [40] => 90 [41] => 1917 [42] =>
1289 [43] => 2051 [44] => 1534 [45] => 1 [46] => 2 [47] => 4 [48] => 4
[49] => 7 [50] => 8 [51] => 9 [52] => 18 [53] => 22 [54] => 5 [55] =>
3 [56] => 1 [57] => 1 [58] => 2 )

JpGraph ERROR 25121



From the research I have done so far using Jpgraph I have found this
link to a similar issue:

http://ubuntuincident.wordpress.com/tag/jpgraph/

but I am unable to get my arrays from the sql query to populate the graph.

Thank you in advance,

Chris

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Chris Stinemetz [ So, 27 März 2011 14:59 ] [ ID #2057172 ]
PHP » gmane.comp.php.database » jpgraph and mysql passing array

Vorheriges Thema: Need Help with PHP Mails
Nächstes Thema: Stored Procedures, Dynamic SQL or static SQL and testing.