Hallo,
Ich habe diesen phplot code geschrieben
und will das wenn ich die Datei (siehe unten) auf der Website aufruf das obere Diagramm mit angezeigt wird.
Wie mach ich das?
Ist der phplot zugriff Code überhaupt richtig?
Danke.
Ich habe diesen phplot code geschrieben
PHP:
<?php
// here we include the PHPlot code
require_once ('phplot/phplot.php');
include('db_connect.inc.php');
$data = array();
$sql = "SELECT * FROM `test becker` WHERE id = 2 ORDER BY zeitstempel DESC LIMIT 10" ;
$x = 'zeitstempel'
while($row = mysql_fetch_assoc($sql,$db))
{
$data [] = array('', $x, $row['spg']);
}
$plot = new PHPlot(800, 600);
$plot->SetImageBorderType('none');
$plot->SetPlotType('lines');
$plot->SetDataType('data-data');
$plot->SetDataValues($data);
//Specify plotting area details
$plot->SetTitle('Wochenasicht LKW');
$plot->SetYTitle('Spannung');
$plot->SetXTitle('Zeit');
$plot->SetLegend(array('Spannungs verlauf'));
$plot->SetDataColors(array('red'));
//Define the axis
$plot->SetPlotAreaWorld(NULL, NULL, NULL, NULL);
//Disable image output
$plot->SetPrintImage(false);
//Draw the graph
$plot->DrawGraph();
?>
und will das wenn ich die Datei (siehe unten) auf der Website aufruf das obere Diagramm mit angezeigt wird.
Wie mach ich das?
Ist der phplot zugriff Code überhaupt richtig?
Danke.
PHP:
<?php
//echo "Inhalt der Datei: WochenasichtLKW.inc.php";
include('db_connect.inc.php');
//SQL-Befehl vorbereiten
$sql = "SELECT * FROM `test becker` WHERE id = 2 ORDER BY zeitstempel DESC LIMIT 10" ;
$erg = mysql_query ($sql,$db) or die ("Fehlermeldung=". mysql_error());
$anz = mysql_num_rows($erg);
echo "<table>";
echo "<thead>";
echo "<tr><th>id</th><th>zeitstempel</th><th>variante</th><th>spg</th><th>verbindung</th><th>komentar</tr>";
echo "</thead";
echo "<tbody>";
for ($i=0; $i<$anz; $i=$i+1)
{
$a=mysql_result($erg, $i, "id");
$b=mysql_result($erg, $i, "zeitstempel");
$c=mysql_result($erg, $i, "variante");
$d=mysql_result($erg, $i, "spg");
$e=mysql_result($erg, $i, "verbindung");
$f=mysql_result($erg, $i, "komentar");
echo"<tr><td>$a</td><td>$b</td><td>$c</td><td>$d</td><td>$e</td><td>$f</tr>";
}
echo "</tbody>";
echo "</table>";
?>
Zuletzt bearbeitet von einem Moderator: