Nr= Id,
Fecha = Datum,
TIME = Uhrzeit,
Contador = Zähler,
kwreal = am Tag eingelesten Kilowat
kw = Die Diferenz von kwreal und am selben Tag eingelesenen Kilowat
kwpreis = der zur Zeit gültige Kilowat Preis
Im Moment muß ich die Diferenz von noch vor der mit dem Taschenlechner ausrechnen , da ich den letzten Eintrag noch nich auslesen kann.(weis den Code nicht).
Nachfolgend meine verwendeten Code.
Eingabeseite: (index.php)
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Aministaration</title>
<style>
<!--
.auto-style1 {
color: #008080;
}
-->
</style>
</head>
<body>
<p align="left"><font color="#008080">DETAILS:</font></p>
<form action="detail_script.php" method="POST">
<table border="3" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#808080" width="100%" id="AutoNumber1" height="211">
<tr>
<td width="24%" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0" height="31">
<font color="#008080">Contador:</font></td>
<td width="76%" height="31">
<font color="#008080" size="5">
<select name="contador" size=1>
<option>Strasse
<option>Pool
<option>Coche
<option>
</select></font></td>
</tr>
<tr>
<td width="24%" height="41"><font color="#008080">Nr: von bis:</font></td>
<td width="76%" height="41"><font size=4 color=#008080><p>
von:</font><font size=5 color=#008080> <u><b>
<input type="text" name="von" size="10"></b></font><font size=4 color=#008080>bis: </font><font size=5 color=#008080><b>
<input type="text" name="bis" size="10"></font></u></td>
</tr>
<tr>
<td width="24%" height="40"> </td>
<td width="76%" height="40">
<input type="submit" value="absenden!!" size="20">
<input type="reset" value="reset!!"></td>
</tr>
</table>
</form>
<p> </p>
<p align="left"><font color="#008080">EINGABE:</font></p>
<form action="pool_script.php" method="POST">
<table border="3" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#808080" width="100%" id="AutoNumber3">
<tr>
<td width="24%" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">
</td>
<td width="24%" bordercolorlight="#C0C0C0" bordercolordark="#C0C0C0">
<font color="#008080">Datum:</font></td>
<td width="76%">
<b><font size=5 color=\"#008080\">
<u><font size=5 color=#008080>
<input type="text" size="14" name="Fecha"></font></u></font></td>
</tr>
<tr>
<td width="24%"> </td>
<td width="24%"><font color="#008080">Uhrzeit:</font></td>
<td width="76%"><b><font size=5 color=\"#008080\">
<u><font size=5 color=#008080>
<input type="text" size="14" name="TIME"></font></u></font></td>
</tr>
<tr>
<td width="24%"> </td>
<td width="24%"><font color="#008080">Contador:</font></td>
<td width="76%">
<font color="#008080" size="5">
<select name="contador" size=1>
<option>Strasse
<option>Pool
<option>Coche
<option>
</select></font></td>
</tr>
<tr>
<td width="24%"> </td>
<td width="24%"><font color="#008080">Kw:</font></td>
<td width="76%"><b><u><font size=5 color=#008080>
<input type="text" size="14" name="kw"></font></u></td>
</tr>
<tr>
<td width="24%"> </td>
<td width="24%"><font color="#008080">Komentar:</font></td>
<td width="76%"><b>
<font size=5 color=\"#008080\">
<u><font size=5 color=#008080>
<input type="text" size="14" name="comentar" style="width: 659px"></font></u></font></td>
</tr>
<tr>
<td width="24%"> </td>
<td width="24%">
<font color=\"#008080\">
<span class="auto-style1">kwpreis</span><font color="#008080">:</font></font></td>
<td width="76%"><b>
<font size=5 color=\"#008080\">
<u><font size=5 color=#008080>
<input type="text" size="14" name="kwpreis" style="width: 204px"></font></u></font></td>
</tr>
<tr>
<td width="24%"> </td>
<td width="24%"><font color="#008080">User:</font><input type="text" name="name" size="19" /></td>
<td width="76%"><font color="#008080"> Passwort: </font>
<input type="password" name="pass" size="19" /></td>
</tr>
<tr>
<td width="24%"> </td>
<td width="24%"> </td>
<td width="76%">
<input type="submit" value="absenden!!" size="20">
<input type="reset" value="löschen!!"></td>
</tr>
</table>
</font></u>
<p> </p>
</form>
<p><font color="#008080">LISTING:</font></p>
</body>
</html>
<?php
include("blutdruck.inc");
$db->echoquery("select Nr, Fecha, TIME, contador, kw, comentar, kwpreis from werte ORDER BY Nr DESC");
?>
INSERT Seite: (pool_script.php)
<?php
$name = $_POST["name"];
$pass = $_POST["pass"];
$Fecha = $_POST["Fecha"];
$TIME = $_POST["TIME"];
$contador = $_POST["contador"];
$kw = $_POST["kw"];
$comentar = $_POST["comentar"];
$kwpreis = $_POST["kwpreis"];
if($name == "6696" or $pass == "6696" )
{
$server = "localhost";
$user = "lilly";
$pass = "seppi";
$datenbank = "pool";
$verbindung = mysql_connect($server,$user,$pass) or die ("Keine Verbindung möglich. Prüfen Sie die Zugangsdaten oder wenden Sie sich an den Administrator.");
mysql_select_db($datenbank) or die ("Die Datenbank existiert nicht. Prüfen Sie die Schreibweise oder wenden Sie sich an den Administrator.");
$dbh = mysql_connect($server, $user, $pass);
#Eintragen================
$eintrag = "INSERT INTO werte (Fecha, TIME, contador, kw, comentar, kwpreis) VALUES ('$Fecha','$TIME', '$contador', '$kw', '$comentar','$kwpreis')";
$eintragen = mysql_query($eintrag);
header("Location: index.php");
}
else
{
header("Location:
Google ");
#echo "falsch!";
}
Ausgabeseite: (detail_script.php)
<?php
$von = $_POST["von"];
$bis = $_POST["bis"];
include("pool.inc");
$strompreis2 = "0.1110";
if($contador == 'Coche')
{
$strompreis1 = "0.0840";
$abfrage = "SELECT sum(kw) FROM werte WHERE Nr > $von AND Nr < $bis AND contador LIKE 'Coche' ";
$ergebnis = mysql_query($abfrage);
$summe_ing_euro_alex = mysql_result($ergebnis, 0);
$a = "". number_format( $summe_ing_euro_alex, 2)."";
echo "<br>" ;
$a1 = $a * $strompreis1;
echo "Gesamtpreis für den angegebenen Strompreis ist ";
echo $a1;
echo " Euros";
}
else
#
if($contador == 'Strasse')
{
$abfrage = "SELECT sum(kw) FROM werte WHERE Nr > $von AND Nr < $bis AND contador LIKE 'Strasse' ";
$ergebnis = mysql_query($abfrage);
$summe_ing_euro_alex = mysql_result($ergebnis, 0);
$a = "". number_format( $summe_ing_euro_alex, 2)."";
$strompreis2 = "0.1110";
echo 'Strasse im angegebenen Zeitraum =';
echo $a;
echo 'Kw';
echo "<br>" ;
$a1 = $a * $strompreis2;
echo "Gesamtpreis für den angegebenen Strompreis ist ";
echo $a1;
echo " Euros";
}
else
{
if($contador == 'Pool')
{
$abfrage = "SELECT sum(kw) FROM werte WHERE Nr > $von AND Nr < $bis AND contador LIKE 'Pool' ";
$ergebnis = mysql_query($abfrage);
$summe_ing_euro_alex = mysql_result($ergebnis, 0);
$b = "". number_format( $summe_ing_euro_alex, 2)."";
$strompreis1 = "0.0840";
echo 'Pool im angegebenen Zeitraum =';
echo $b;
echo ' Kw';
echo "<br>" ;
$b1 = $b * $strompreis1;
echo "Gesamtpreis für den angegebenen Strompreis ist ";
echo $b1;
echo " Euros";
}
}
$db->echoquery("select Nr, Fecha, TIME, contador, kw, realkw, comentar, kwpreis from werte WHERE Nr > $von AND Nr < $bis ORDER BY Nr DESC ");
?>