Re: jpgraph and mysql passing array
| From: | David Robley | Date: | Thu, 24 Mar 2011 00:05:54 +0000 |
| Subject: | Re: jpgraph and mysql passing array | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-47732@lists.php.net to get a copy of this message | ||
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.