hallo leute,
ich hab mir heute nen code für nen graphen rauskopiert und für mich abgeändert
seit ich das ganze aber mit datenbank machen will haut gar nix mehr und es kommt immer die meldung :
http://michipage.mi.ohost.de/graph.phpDie Grafik „http://michipage.mi.ohost.de/graph.php“ kann nicht angezeigt werden, weil sie Fehler enthält.
ich weiß aber nicht was des bedeutet bzw. wo der fehler liegt …
hier mal der code vll könnt ihr mir ja helfen
ich hab die vermutung das vll i-was mit dem array nicht stimmt -.-
[PHP]
<?php
mysql_connect("localhost", "----", "----")
or die("Keine Verbindung möglich: " . mysql_error());
mysql_select_db("michipage");
//biene
$result = mysql_query("SELECT * FROM camel WHERE name='Biene'");
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$graphbiene=array($row[2], $row[3], $row[4], $row[5], $row[6], $row[7], $row[8], $row[9], $row[10], $row[11], $row[12], $row[13], $row[14], $row[15], $row[16], $row[17], $row[18], $row[19], $row[20], $row[21], $row[22]);
}
print_r( $graphbiene);
//lukas
$result = mysql_query("SELECT * FROM camel WHERE name='Lukas'");
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$graphbiene=array($row[2], $row[3], $row[4], $row[5], $row[6], $row[7], $row[8], $row[9], $row[10], $row[11], $row[12], $row[13], $row[14], $row[15], $row[16], $row[17], $row[18], $row[19], $row[20], $row[21], $row[22]);
}
// Add values to the graph
//$graphbiene=array(250,240,230,240,250,260,250,260,250,250,240,250,260,270,290, 280, 270, 260, 250, 240, 250);
// Define .PNG image
header("Content-type: image/png");
$imgWidth=500;
$imgHeight=250;
// Create image and define colors
$image=imagecreate($imgWidth, $imgHeight);
$colorWhite=imagecolorallocate($image, 255, 255, 255);
//rgb
$coloryellow=imagecolorallocate($image, 255, 255, 0);
$colorGrey=imagecolorallocate($image, 192, 192, 192);
$colorBlue=imagecolorallocate($image, 0, 0, 255);
// Create border around image
imageline($image, 0, 0, 0, 250, $colorBlue);//links
imageline($image, 0, 0, 500, 0, $colorGrey);//oben
imageline($image, 500, 500, 500, 0, $colorGrey);//rechts
imageline($image, 0, 250, 250, 500, $colorBlue);//unten
// Create grid
for ($i=1; $i<250; $i++){
imageline($image, $i*12.5, 0, $i*12.5, 250, $colorGrey);//quer
imageline($image, 0, $i*12.5, 500, $i*12.5, $colorGrey);
}
imageline($image, 0, 125, 500, 125, $colorBlue); // links, oben, rechts, unten, farbe
// Add in graph values
for ($i=0; $i<20; $i++){
imageline($image, $i*25, (250-$graphbiene[$i]), ($i+1)*25, (250-$graphbiene[$i+1]), $coloryellow);
imageline($image, $i*25, (375-$graphlukas[$i]), ($i+1)*25, (375-$graphlukas[$i+1]), $colorBlue);
}
// Output graph and clear image from memory
imagepng($image);
imagedestroy($image);
?>
[/PHP]mfg daschifahrer