Re: [PHP-DB] Re: jpgraph and mysql passing array
On Sat, Mar 26, 2011 at 9:44 PM, Brian Smither 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] => 3 [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
[PHP-DB] Re: jpgraph and mysql passing array
Would you try an experiment? 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. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] 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: > > --- > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> > http://www.w3.org/1999/xhtml";> > > KCRF Dashboard > 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); > > ?> > 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