clanstyles Posted August 22, 2007 Share Posted August 22, 2007 JpGraph Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /mnt/backside/vol/skyblue/spunky/hyp3r/gungame.cswiki.org/technicolor/newgraph.php on line 9 JpGraph Error: HTTP headers have already been sent. Caused by output from file newgraph.php at line 9. Explanation: HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text). Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser. For example it is a common mistake to leave a blank line before the opening "<?php". <?php include ("config.php"); include ("jgraph/jpgraph.php"); include ("jgraph/jpgraph_line.php"); $result = mysql_query("SELECT * FROM `servers` WHERE `enabled`='1'") or die(mysql_error()); $res = mysql_fetch_array($result); $num = mysql_num_rows($res); $dataArray[$num-1]; // Some data $d = 0; foreach($res as $data) { $res = mysql_query("SELECT AVG(size) FROM `serverInfo` GROUP BY `timestamp`"); $res1 = mysql_fetch_array($res); $dataArray[$d] = $res1; $d++; } $datay = array(28,19,18,23,12,11); $data2y = array(14,18,33,29,39,55); // A nice graph with anti-aliasing $graph = new Graph(800,400,"auto"); $graph->img->SetMargin(40,180,40,40); $graph->img->SetAntiAliasing("white"); $graph->SetScale("textlin"); $graph->SetShadow(); $graph->title->Set("Background image"); // Use built in font $graph->title->SetFont(FF_FONT1,FS_BOLD); // Slightly adjust the legend from it's default position in the // top right corner. $graph->legend->Pos(0.05,0.5,"right","center"); // Create the first line $p1 = new LinePlot($datay); $p1->mark->SetType(MARK_FILLEDCIRCLE); $p1->mark->SetFillColor("red"); $p1->mark->SetWidth(4); $p1->SetColor("red"); $p1->SetCenter(); $p1->SetLegend("Triumph Tiger -98"); $graph->Add($p1); // ... and the second $p2 = new LinePlot($data2y); $p2->mark->SetType(MARK_FILLEDCIRCLE); $p2->mark->SetFillColor("blue"); $p2->mark->SetWidth(4); $p2->SetColor("blue"); $p2->SetCenter(); $p2->SetLegend("New tiger -99"); $graph->Add($p2); // Output line $graph->Stroke(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/66239-jpgraph-help/ Share on other sites More sharing options...
clanstyles Posted August 23, 2007 Author Share Posted August 23, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/66239-jpgraph-help/#findComment-332123 Share on other sites More sharing options...
marcus Posted August 23, 2007 Share Posted August 23, 2007 Make: $num = mysql_num_rows($res); This: $num = mysql_num_rows($result); Quote Link to comment https://forums.phpfreaks.com/topic/66239-jpgraph-help/#findComment-332127 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.